Script Timing

Started by earlwood, Mon 26/04/2004 05:42:05

Previous topic - Next topic

earlwood

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

strazer

You have to use blocking commands:

AnimateCharacterEx(POD, 8, 2, 0, 0, 1);
MoveCharacterBlocking(POD, 204, 177, 0);
MoveCharacterBlocking(POD, 9, 4, 0);

earlwood

But now my ShakeScreenBackround (which is in under repeatedly execute) won't work until they are done... :P

strazer

#3
Try to put the ShakeScreenBackround in repeatedly_execute_always.
It's a feature of the latest betas:
"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!

Ginny

#4
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. ;)
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

strazer

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.

Ginny

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 :).
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

earlwood

Sweet, I didn't know there was a 'while' function.  ;D

Thank you,
Earlwood

SMF spam blocked by CleanTalk