Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Nostrum on Wed 20/08/2003 04:14:43

Title: Interaction menu problems
Post by: Nostrum on Wed 20/08/2003 04:14:43
If I have a series of events under a certain option in the interaction menu for an object, the actions don't happen in the order I put them in. For example, if under "Interact object" the action order is like this...

-Run script
-Character - Move Character, (WAR, 51, 172, true)

It'll move the character first and THEN run the script. Any help appreciated.
Title: Re:Interaction menu problems
Post by: Ginny on Wed 20/08/2003 04:23:01
Hmm, well maybe it's default is to Run Scripts first.

How to solve it: Use a command for moving the character at the end of the script. Unless that won't work in this case, like if you have a dialog and you want it to start before the char moves.

Hmmm
Title: Re:Interaction menu problems
Post by: Nostrum on Wed 20/08/2003 05:49:54
No, that won't work for this situation... thanks anyway.

Anyone got more help? This problem's really getting in the way of me making progress in my game.  :-\
Title: Re:Interaction menu problems
Post by: Scummbuddy on Wed 20/08/2003 06:00:31
What kind of script do you have before the move character function?  Is it blocking or not?  Try putting a "Wait(120);" in between the codes.
Title: Re:Interaction menu problems
Post by: Gilbert on Wed 20/08/2003 08:32:39
I'm not sure but it is possible that script runs at the end of interaction menu.

However, as you had one of the interaction ste to run script already, why don't you put EVERYTHING in that interaction into the text script part? (ie just do the movecharacter in text script in your case)

In my opinion, mixing "run script" and some other interactions in a single interaction may not be a good habit.
Title: Re:Interaction menu problems
Post by: inFERNo on Wed 20/08/2003 09:37:01
Well, I had the same problem in the beginnen and found out that every interaction in the list is executed first, the run script always when all others are done. I don't know why this is but the solution is simple. Just delete the interactions and put them into the Run Script. To move a character for example you need to write
MoveCharacterBlocking (CHARID, int x, int y, int);
The blocking is that the character moves to the given position and waits with any further commands until he's there. the last int is set either to 0 or 1 where 1 makes him move there directly, ignoring the walkable areas, so usually you will want to set it to 0.
After that you put all further commands.
Hope this helps.
Title: Re:Interaction menu problems
Post by: Nostrum on Wed 20/08/2003 18:54:13
That seems to work well, except there's an error in the script... I got an error message for MoveCharacter(WAR, 58, 172, 1); because it's got the "wrong number of parameters". My guess is that it's talking about that "1" on the end, but I thought you said that putting a 1 there would make him move to his destination directly, ignoring walkable areas. Hmm...
Title: Re:Interaction menu problems
Post by: Ishmael on Wed 20/08/2003 19:01:25
MoveCharacterBlocking(WAR, 58, 172, 1);

The MoveCharacter don't have the DIRECT param... You need to use MoveCharacterDirect(...); if you want it to be non-blocking... ;)
Title: Re:Interaction menu problems
Post by: Scummbuddy on Wed 20/08/2003 19:02:23
you forgot the word blocking. check it out in the manual

MoveCharacterBlocking
MoveCharacterBlocking (CHARID, int x, int y, int direct)

Moves the character CHARID to location (X,Y), waiting until they arrive there before returning to the script.
If DIRECT is 0, this acts like MoveCharacter; if it is 1 then this acts like MoveCharacterDirect.

Example:

MoveCharacterBlocking(EGO,234,122,1);

will make the character EGO walk to 234,122 ignoring walkable areas and return the control to the player when he gets there.
Title: Re:Interaction menu problems
Post by: inFERNo on Wed 20/08/2003 19:48:31
Here's something very handy:
If you aren't sure about a command and if there might be variations of it, just highlight it and press F1. You will automagically be directed to the specific command in the help file that will tell you what it does.
Title: Re:Interaction menu problems
Post by: Nostrum on Wed 20/08/2003 20:04:10
Yeeeaarrrgghhhee. This is massively infuriating. I fixed the script so that there are no errors in it now. I have it so that when you interact with the door, it runs this script:

MoveCharacterDirect (WAR, 66, 175);
SetCharacterView (WAR, 8);
AnimateCharacter (WAR, 0, 5, 0);
ReleaseCharacterView (WAR);
FaceLocation(GetPlayerCharacter(),character[GetPlayerCharacter()].x,0);

Yet, much to my despair, when I interact with the door in-game, nothing happens. At all.
Title: Re:Interaction menu problems
Post by: Scummbuddy on Wed 20/08/2003 20:28:51
Are you using braces for your interactions that use more than one command?  If not, then it will ignore ones after the first command.
Title: Re:Interaction menu problems
Post by: Nostrum on Wed 20/08/2003 22:28:58
I'm not exactly sure what you mean by that. Could you explain more thoroughly?
Title: Re:Interaction menu problems
Post by: Scummbuddy on Thu 21/08/2003 07:39:38
Here's an example that I currently helped someone with braces questions.

http://www.agsforums.com/yabb/index.php?board=6;action=display;threadid=7795