Author Topic: Delay/Sleep  (Read 2370 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
Delay/Sleep
« on: June 09, 2003, 04:25:08 PM »
Is there a delay/sleep command I can use or should I remove input/control from the user and enter a for-loop?



Kon-Tiki

  • Guest
Re:Delay/Sleep
« Reply #1 on: June 09, 2003, 04:31:16 PM »
It depends on what you're trying to do, but if it has to do with slowing down animations, try the cycle.time-command (or one of its variants, check the helpfile for them)

-Kon-Tiki-

guest

  • Guest
Re:Delay/Sleep
« Reply #2 on: June 09, 2003, 04:42:23 PM »
Well, I draw an animation, then I'd like that animation to play for a while and noting else should be happening in the scene (disabled input, movement etc.). After 3-4 seconds of animation I want the animation to end and gameplay continue. That simple, just thought that there might be some obscure sleep/delay thing but maybe not.. so I should loop a while by my own?

Offline Corby

Re:Delay/Sleep
« Reply #3 on: June 09, 2003, 07:48:08 PM »
I do this a lot... I just use:
program.control();    (To stop the ego from doing anything)

and

prevent.input();    (To disable input)

also,

stop.motion(o0);  will make sure that the ego stops moving when an animation scene is occuring.

make sure to counter-act these commands when the animation is finshed with:
player.control();
accept.input();
start.motion(o0);

Hope this helps... it's what I do.

guest

  • Guest
Re:Delay/Sleep
« Reply #4 on: June 10, 2003, 12:56:34 AM »
Yes, I know abot those commands.. but they don't actually _wait_. I.e I want an animation to play for exactly five seconds, how is that possible?

Offline kryddturken

Re:Delay/Sleep
« Reply #5 on: June 10, 2003, 12:58:45 AM »
Ugh, I forgot to log in.. well, it's me asking the questions anyway :)

Offline Corby

Re:Delay/Sleep
« Reply #6 on: June 10, 2003, 01:07:07 AM »
You could use a simple timer:

if(isset(f100)){
animate.obj(o1);
load.view(100);
set.view(o1,100);
position(o1,100,100);
draw(o1);
set(f101);           (sets timer)
}

if(isset(f101)){        (actual timer)
v100+=1;
}

if(v100==30){   (Change the 30 for how long 5 sec take)
v100=0;
reset(f101);
stop.cycling(o1);
}

Just make sure to set v100 to 0, and reset the timer flag.

Offline kryddturken

Re:Delay/Sleep
« Reply #7 on: June 10, 2003, 01:26:54 AM »
Oh, so it's called timer.. *browses help chapters*. There, thanks a lot Corby!

Offline Corby

Re:Delay/Sleep
« Reply #8 on: June 10, 2003, 03:54:52 AM »
No problem :)

Offline kryddturken

Re:Delay/Sleep
« Reply #9 on: June 11, 2003, 07:50:33 AM »
Ok, so if I get things right (just double checking.. I might be able to save myself a lot of work).

If I trigger something from i.e a command that the user inputs ("post forum") and I want a series of animated events (timebased) to occur after that I have to catch those in the main-loop since that's where the cycles are processed and not in the if(said("post... etc.. right? And there I put my timers.. right?

Kon-Tiki

  • Guest
Re:Delay/Sleep
« Reply #10 on: June 11, 2003, 08:40:37 AM »
That's correct. A timer is actually just a variable that's in/decreased with every interpreter cycle. Just make it so that the interpreter'll keep on cycling through the part with the timer-code and it'll be allright.

-Kon-Tiki-

Offline kryddturken

Re:Delay/Sleep
« Reply #11 on: June 11, 2003, 09:02:54 AM »
It's working perfectly! Hooray! The first screen is coming along just fine.. wow, this AGI stuff sure is addictive... oh well. Thanks a lot for the input, I understand this to the fullest extent now :).


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.04 seconds with 22 queries.