Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: earlwood on Mon 26/04/2004 05:42:05

Title: Script Timing
Post by: earlwood on Mon 26/04/2004 05:42:05
Ok, I am almost completely done drawing the pictures for the cinematics of my game..but in a script, how do I make of list of things I want done one at a time?

See I have this as a script:
AnimateCharacter(POD,8,2,0);
 MoveCharacter(POD,204, 177);
 MoveCharacter(POD,9,4);

but it tries to do it all at once, so the animation gets cut off then the pod moves in a generally diagonal direction..

How can I script that I want that done one at a time? Or do I have to keep making new scripts for everything that needs to be done...

Thanks In Advance,
Earlwood
Title: Re:Script Timing
Post by: strazer on Mon 26/04/2004 05:48:48
You have to use blocking commands:

AnimateCharacterEx(POD, 8, 2, 0, 0, 1);
MoveCharacterBlocking(POD, 204, 177, 0);
MoveCharacterBlocking(POD, 9, 4, 0);
Title: Re:Script Timing
Post by: earlwood on Mon 26/04/2004 13:27:03
But now my ShakeScreenBackround (which is in under repeatedly execute) won't work until they are done... :P
Title: Re:Script Timing
Post by: strazer on Mon 26/04/2004 13:35:58
Try to put the ShakeScreenBackround in repeatedly_execute_always.
It's a feature of the latest betas (http://www.adventuregamestudio.co.uk/yabb/index.php?board=2;action=display;threadid=12051):
"repeatedly_execute_always is always called - even when a blocking function is running"

If you don't want to use a beta version, wait for v2.61, it should be out soon. But I've found the betas to be quite stable. Nevertheless, remember to backup you game before trying them!
Title: Re:Script Timing
Post by: Ginny on Mon 26/04/2004 14:41:41
Yes, that feature is great! A workaround though could be using it like this:

int animating;
-----------------------

AnimateCharacter(POD,8,2,0);
animating = character[POD].animating;

while (animating != 0) {
animating = character[POD].animating;
}
if (animating == 0) {
MoveCharacter(POD,204, 177);
MoveCharacterPath(POD,9,4); //moves the character to these coordinates only after the char has completed the previous move
animating = 1;
}

I'm not sure this'll work, but it might.. :)

Of course, using the new function would be much easier. ;)
Title: Re:Script Timing
Post by: strazer on Mon 26/04/2004 15:02:06
You're right!

You could also call repeatedly_execute manually:

AnimateCharacter(POD,8,2,0);
while (character[POD].animating) {
repeatedly_execute();
wait(1);
}
MoveCharacter(POD,204, 177);
MoveCharacterPath(POD,9,4);

But that's bad practice. It would be better to put that part of the repeatedly_execute in a custom function and call that function from both the repeatedly_execute and this while loop.
Title: Re:Script Timing
Post by: Ginny on Mon 26/04/2004 15:18:06
I never knew calling a function that is running as it is, or calling a built-in function in general, was possible. Creating a custom function for it to override the wait(1) would probably work better, yes. And the code would be less messy than mine, which is so messy cause I wanted to avoid the wait(*) function :).
Title: Re:Script Timing
Post by: earlwood on Tue 27/04/2004 00:06:05
Sweet, I didn't know there was a 'while' function.  ;D

Thank you,
Earlwood