Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Dadalus

#121
Stupot+ knows his stuff and I might give those videos a look myself.

Quote from: TheresaGamer on Tue 26/08/2014 03:26:29
...I heard that it takes about a week or so to learn coding for this program. How well off will I be with making a game with this program.

From personal experience (I am new to AGS myself, though I have coded in other languages) its fairly easy to get a working knowledge of using the editor and writing simple code. I have asked questions about coding and what the best approaches to are to solve certain problems and the community response was quick, helpful and above all courteous. People are more than happy to help you develop your skills. As long as you invest the time you'll get going pretty quickly.

Bear in mind that you will need a story and artwork, and the community will help you develop the skills you need for those as well (If needed.)

There will be times ahead when your tearing your hair out, but every person (and I mean EVERYONE) here has had those same moments.

Welcome and Good Luck.
#122
Thanks Khris , that sorted it. I could have sworn Id tried using 'export' but I must have not included the 'import'.
#123
General Discussion / Re: We are not bemused
Mon 25/08/2014 21:44:12
No I suppose not, I just find it grating, though its no biggie.

'That'll learn em' :)
#124
General Discussion / Re: We are not bemused
Mon 25/08/2014 20:42:10
A form of emphasis, rather than the pet peeve of mine when someone says something along the lines of 'I literally fell to pieces'.

I'm being pedantic. 'The pedants are revolting' .. 'Let them eat books on grammar' (exits stage left)
#125
I have an odd problem that for the life of me I cant figure out. I have a struct containing an integer array and a function that initializes the arrays values.

Header:
Code: ags
struct stUserEvents 
{ 
  int eventqueue[NUMBER_EVENTS];
  import void Initialise(); 
};

stUserEvents UserEvent;

script:
Code: ags
void stUserEvents::Initialise()
{
  int intLoop=0;
  while (intLoop<NUMBER_EVENTS)
  {
    this.eventqueue[intLoop]=eNoEvent;
    intLoop++;
  }
}


in game_start I have
Code: ags
UserEvent.Initialise();


trouble is the values are not being set.

If I take out the integer array from the struct and place it in my script

Code: ags
int eventqueue[NUMBER_EVENTS];

void stUserEvents::Initialise()
{
  int intLoop=0;
  while (intLoop<NUMBER_EVENTS)
  {
    eventqueue[intLoop]=eNoEvent;
    intLoop++;
  }
}


the values are set.

Can anyone tell me what I am not seeing, I'm assuming its just down to my rusty skills and me just not getting some principle.
#126
I think I've figured figured it out there is a capital 'T' and 'C' in fAddToMyCounter in the dialog script, whilst the main script its 'fAddtoMycounter" (lower case 't' & 'c'). Function names are case sensitive, change the names so they match will fix the error your getting.

My error I typed in the Dialog script in the post and put in the 'T' & 'C', I should have copied it straight from my test code. Basic schoolboy error.

EDIT: the code was written in a rush so I didn't capitalize the beginning of each new word in each of the function names, I usually name functions with a small f followed by a brief description eg 'fThisIsMyFunctionNameExample'. It doesnt have to be done this way, you can name a function anyway you want as long as when you call it the name is exactly the same.
#127
That seems OK, not sure why your having a problem. Is the new Script above the global script? have you removed all your previous MyCounter variables (including any global ones?).

I have tested this in a small test game I'm building for something else, and it works just fine. If you can't fix it, then zip up a copy of your game folder (winrar or 7zip) and upload it to MediaFire (or some other filehosting site) then PM me with a link and I will look at it.
#128
Could you post the dialog script? I have tested this and it works, so im not sure why your getting that error (have you added the imports?).
#129
I hadn't considered that.

I would do it this way.

1. set up a new script called 'MyCounter'

2. in MyCounter.asc

Code: ags
int MyCounter=0;

function fTestMyCounter()
{
  if (MyCounter == 3 && !object[2].Visible)
  {
     object[2].Visible = true;
  }

  //else if ...(put your other tests and actions here)

}

function fAddtoMycounter(int Value)
{
  MyCounter=MyCounter+Value;
  //test and perform actions
  fTestMyCounter();
}
function SetMyCounterValue(int Value)
{
  MyCounter=Value;
  //test and perform actions
  fTestMyCounter();  
}
function GetMycounterValue()
{
  return MyCounter;
}


in MyCounter.ash

Code: ags
import function GetMycounterValue();
import function SetMyCounterValue(int Value);
import function fAddtoMycounter(int Value);
import function fTestMyCounter();


then in the example you have already given

Code: ags
@1 
Shak: Don't call me ma'am!
  fAddToMyCounter(3);



But thats my way of doing things (probably from using VB). Gurok has a lot more experience in AGS than I do, so hopefully he will let us know if thats the correct approach.

EDIT: you would never have access to the MyCounter variable from outside the MyCounter script. You would use fAddtoMycounter, GetMycounterValue and SetMyCounterValue instead. You would have to remove any existing MyCounter variables, and replace adding etc with the functions.
#130
"A thousand mile journey begins with a single step".

I'm new to AGS myself, though I have a lot of experience in 'Visual Basic'.

You can place your function in the global script, or in a new script. In the script header 'under edit header' you would need to write a line
Code: ags
import function fTestMyCounter();

then it will be available to rooms dialogs etc.

#131
Quote
Code: ags
function repeatedly_execute_always()
{

    if (myCounter == 3) 
  {
     object[2].Visible = true;
  }
}



Your setting object[2].visible every time repeatedly_execute_always() and mycounter=3 this would lead to setting the object to visible 1000s of times. You only need to do it
Code: ags
if (myCounter == 3 && !object[2].Visible) 
.

But do you need to do it that way? couldnt you do
Code: ags
@1 

Shak: Don't call me ma'am!

  myCounter +=3;

  if (myCounter == 3) 
  {
     object[2].Visible = true;
  }


EDIT: I am assuming that you want to change various things each time the counter changes, but using repeatedly execute is not an approach I would use. I would write a function  .
Code: ags
function fTestMyCounter()
{
  if (myCounter == 3 && !object[2].Visible) 
  {
     object[2].Visible = true;
  }
  else if ...(put your other tests and actions here)
  
  
}


then call that function every time you change myCounter.


#132
Thats along the lines of something I was thinking of (only better :)).

Ive decided to create a test game, very small in size, as a proof of concept for the 'state machine' (still not sure if thats the right phrase), I doubt it will include the character workaround. If anyone is interested in it Ill release the source code. Its not completed yet, should have it pinned down in a few days.
#133
Khris : I like your thoughts on using more than one character event (I'm using walk,talk,look,interact but the others are free EDIT: Im being silly of course I can use the walk,talk etc events, doh!), and I wasn't aware that you could enter the function directly .

Id considered using consecutive characters but thought I might have problems with any expanding of the game (I would need to have all my game characters set up before my trigger characters, or pad with lots of blank characters for later expansion). I'm developing the story/characters etc at the same time as the game. I have the first section fully planned and an overall plot, but I may need to add game characters later.

I could probably just modify the code your suggesting to include the character as part of the struct (along the lines Crimson Wizard suggested), though it would make it a lot easier if they were consecutive.

Everyone: On a side note, the original post was just to get a simple Yes/No answer, who knew Id get so much out of it! Ive been very interested in your replies/views. Thank you.
#134
I understood what you meant with char but the clarification was nice.( EDIT:No it turns out I didn't :) just looked up the char data type)

As for using dialogs thats a great idea, I may do some testing along those lines.
#135
Crimson Wizard :Didn't know about 'char' that would be a better way of doing it. (Not sure if its awesome though, but thanks for the compliment :))

Gurok : Thanks for that another bit of AGS I wasn't aware of (there are sooooo many) I think that would be simpler.

But its a mute point as I cant see me using this approach its way more time consuming and cumbersome than the if..else if.. approach.
#136
I should have said 'UserMode1" it comes up as Mode8 in the code.

1. Set up a blank character, called "trigger001" or whatever you want.
2. set up the event usermode1 with a call to the function.
Code: ags
function trigger001_Mode8()
{
  fMyFunction001();
}


3. Then within struct for triggers store an int with the character ID.
4. Whenever you need to call a function from this variable use:
Code: ags
character[MyTriggers[1].CharacterID].RunInteraction(eModeUsermode1);


You would need a separate character for each trigger.

Cumbersome, wasteful and inelegant. :)

#137
Snarky thanks for the links. Ill have a look at them to see how others are tackling the same problem. I want to limit the use of other peoples code (for reasons I stated above), so will probably build my own version. Its probably not quite a state machine I'm after but very close. I am not overly familiar with the concept of state Machines (researching them at the moment). Creating my own version will give me a better understanding of how it works.

Iceybot I agree it would be nice but its not essential.

Quick note on calling a function using a variable. My thoughts on using rooms wouldn't work as using on_call only works within the room. I did conduct a test using a characters UserMode8 and Run Interaction. I found I could make a workaround (using the character ID instead of a string), the only trouble was it as widely more unwieldy than if...else... :)

Thanks for the advice all.
#138
I guess what I'm trying to do is build a state machine, and there are probably libraries for Lua. Ill do some research.

Good to see that this may be available in the future.

Now on to EVAL.. :) only kidding.
#139
The Rumpus Room / Re: Oh, the irony
Thu 21/08/2014 19:23:28
One partygoer said "(Insert Chuck Norris joke here")

Its like Dolph Lungren discussing flower power...
#140
Ive built a simple "event handler" so that anything that needs doing (in repeatedly_execute) only happens once per game loop. I'm using a simple list to tell me which event has to be handled if the event cant be handled its pushed to the end of the queue. There are only 10 "events" so I'm using IF..ELSE IF to call the appropriate function that handles each "event". Its working really well and greatly speeds up the game. It also helps when you need to wait for something (eg waiting for the player character to stop moving) and with creating non blocking code.

What I am thinking of doing now is building some kind of triggering system for puzzles. My idea is to create a trigger struct with links to those triggers that depend on it and those that it depends on. Then when something is triggered it calls those that depend on it to check if their dependencies are all triggered (I think that sentence is correct :)). The effect of changing the state of one trigger would then be tracked through all the triggers that are affected.

I could build something like it using the principles from my 'event handler' code. I wanted to be able to store a string within my struct that has the name of the handler function for a particular trigger (to deal with any sequence of commands that occur when a triggers state is changed). I didn't want to have 100s of if..else if commands.

I have considered using the rooms from 300 to 999, and the on_call function. Thats just an idea at this stage I haven't done any testing to see if its possible.

The other idea I had was to build a plugin to create a 'CallFunction' command. I wouldn't need to pass any parameters. I'm not overly familiar with C++, my background is in VB, so I am a little wary of doing it even though it should be simple. Its also been 7 years since I did any serious coding so I'm rustier than a rednecks pick up truck.

I don't want anyone to write the code for me (I will never learn all the Ins and Outs of AGS if I rely on others to code for me :)), but I'm always grateful for any thoughts on the correct approach to tackle a problem.


SMF spam blocked by CleanTalk