Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Mon 28/08/2006 11:26:10

Title: Actions happening in wrong order
Post by: on Mon 28/08/2006 11:26:10
Hi,
Ashen thanks for your help with my last query, got another little one if anyone can help me..
I used the interactions editor to cause a series of events to happen after the player gives a certain item to another bloke, such as display a message, run animation, etc. They all happen, but some things happen in the wrong order, i.e. not in the order they appear in the interactions editor screen. Is there any way to make sure they happen in the order I want them to? ( I don't know how to use script yet)
Also, how do you post a question within the same thread, do you just click "reply"?
Thanks
Title: Re: Actions happening in wrong order
Post by: Ashen on Mon 28/08/2006 11:59:38
Some actions are delayed untill all others have run - this includes Dialogs (RunDialog or 'Game - Run dialog' NOT normal say or display commands) and Changing room - and that's just how AGS works.
In scripting, you can get round this by starting a new 'Run script' interaction for the stuff after RunDialog, or by moving anything after a ChangeRoom into the 'player enters room' interaction of the new room. In the Interaction Editor, I'm not sure how - or even if you CAN - deal with this.
It'd be useful to know exactly what commands you're using, and which ones are out of sequence. You mentioned an animation - are you using the eBlock parameter (or the Interaction Editor equivilant)? If not, the commands after the anim might appear to run in the wrong order.

And, you've already replied in the other thread, why do you need to ask how? If a question is related to an existing thread, just post a new reply in there (or edit your existing reply, if you think of another question immediately after posting). If it's a whole new question - and you can't find the answer anywhere else - just start a new thread (like you have).
Title: Re: Actions happening in wrong order
Post by: on Tue 05/09/2006 19:03:34
Hi,
The series of actions is supposed to happen after the player uses an item on an NPC. In the interactions editor I have set the following actions:

Character: Move character
Character: Face location
Conditional: If inventory item was used (3)
    - Player: Remove an item from the inv. (3)
      Game: Display a message (515)
      Character: Run anim loop (Wen, 8, 8)
      Game: Run dialogue (1)
      Player: Give the Player an item (2)
      Char: Run anim loop (Tom, 8, 8)
      Game: Display a mssg (516)
      Game: Disable dialogue option (0,5)

Conditional: If inv item was used : (4)
    - Game: Display mssg (514)

The problems arise in the first conditional set of actions,as all the actions happen in the wrong order:

Message 515 is shown
Both animations run
Message 516 is shown
Dialogue runs

Is there any way to set the order of the actions? This is also causing problems in other areas of my game as I don't know any way to get the actions to happen in order.
Any help would be much appreciated!
Title: Re: Actions happening in wrong order
Post by: R4L on Tue 05/09/2006 19:06:15
Try using Wait() to block out display mssg commands as the script will put them first. Also add stop runing more commands to close the conditional.
Title: Re: Actions happening in wrong order
Post by: Ashen on Tue 05/09/2006 19:22:57
As has been said a great many times in a great many threads - dialogues (called by script or the 'Game - Run dialog' command) WILL NOT RUN until all other commands have been run. Unfortunately, the only solution I know is to use scripting, and to split the code into two seperate 'Run script' interactions at the RunDialog command.
Title: Delays on Interaction Panel Order
Post by: Sylvr on Thu 07/09/2006 22:30:52
I've tried to find this in the manual, but failing miserably. I was wondering how to delay the next action in the set of 'interactions' I have set up. I've got:

1) Game - Run Dialog
2) Player - Give Player Inventory Item
3) Object - Remove Object from Room
4) Game - Run Dialog

I'm looking to remove the object from the room after the first dialog bit is finished, but I can't find a way to delay it.

Thanks for the help!
Title: Re: Actions happening in wrong order
Post by: Ashen on Thu 07/09/2006 22:36:39
I've merged these, since they're the same issue.

SilverTrumpet: Check my last reply. I don't think it can be done with Interaction Editor commands, only with multiple 'Run scripts'.
Title: Re: Actions happening in wrong order
Post by: Sylvr on Thu 07/09/2006 22:56:03
Thanks for lurking around the beginner boards, ashen. I guess the topics were similar...

The funny part about using the Run Script command (if I understood that right, you're saying we need to remove the speech from the Topic and turn it into a series of cCharacter.Say commands?), was that I had the conversation set like that before, but I needed them to pause in their speech (e.x.: Josh:...). I found no command to accomodate that in the character.command format.

I hope that makes sense.
Title: Re: Actions happening in wrong order
Post by: Ashen on Thu 07/09/2006 23:00:29
I'm not sure what you mean ...

You can still use the dialogs, if you want (read the manual if necessary - it's the RunDialog command). cJosh.Say("..."); SHOULD cause a 'pause' in the same way as 'Josh: ...' does. Or, do you mean like using Wait() to space things out?

And as to 'lurking' around the boards - I am a moderator, it's kind of my job.
Title: Re: Actions happening in wrong order
Post by: Sylvr on Fri 08/09/2006 00:35:32
Okay... This is what my script reads:

RunDialog(4);
Wait(80);
cMan.AddInventory(iBurger);
object[0].Visible = false;
RunDialog(5);


When I added wait, it executed ahead of the dialog(4). What am I doing wrong?
Title: Re: Actions happening in wrong order
Post by: Ashen on Fri 08/09/2006 00:44:45
Read what I said:

"Unfortunately, the only solution I know is to use scripting, and to split the code into two seperate 'Run script' interactions at the RunDialog command."


So, have one 'Run script' that contains:

  RunDialog(4);


Then another containing:

  Wait(80);
  cMan.AddInventory(iBurger);
  object[0].Visible = false;
  RunDialog(5);


That should run everything in the first 'Run script' (in this case just the dialog, but could be anything else you want to happen before that) AND THEN run everything in the second, ending with the other dialog.

Do you actually need the Wait(80); in there? I suggested it because I wasn't sure what you meant by:
 
Quote from: SilverTrumpet on Thu 07/09/2006 22:56:03
I needed them to pause in their speech

So I was suggesting something like:

  cMan.Say("Can I ask you a question?");
  cEgo.Say("Sure.");
  Wait(40); // One second 'pause'
  cEgo.Say("Well?");
Title: Re: Actions happening in wrong order
Post by: Sylvr on Fri 08/09/2006 00:53:19
Ah, thanks very much. I didn't understand about splitting the runscript up like that. What I meant when I needed them to pause was the "...", but the Wait() came in handy for other issues. Sorry I wasn't clearer.

And your suggestion worked perfectly! Thanks again!