Guest |
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 |
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 | 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? |
Corby |
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 | 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? |
kryddturken | Ugh, I forgot to log in.. well, it's me asking the questions anyway :) |
Corby |
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. |
kryddturken | Oh, so it's called timer.. *browses help chapters*. There, thanks a lot Corby! |
Corby | No problem :) |
kryddturken |
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 |
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- |
kryddturken | 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 :). |