Sleep() Function for TorqueScript
by Crimson Rum Khulay Gin · in Technical Issues · 10/16/2007 (1:52 am) · 5 replies
Is there an equivalent of this in TorqueScript?
I found this great barebones tutorial Sir Charles Patterson and I just want to practice it by doing the traditional looping and spiraling stars we used to do in Turbo C. However, I need to insert some sort of delay(timeunit); function in the loop in order to achieve the animated effect.
Can't seem to find any of it in the free TorqueScript documentation I found. Thanks a lot in advance everyone. :)
I found this great barebones tutorial Sir Charles Patterson and I just want to practice it by doing the traditional looping and spiraling stars we used to do in Turbo C. However, I need to insert some sort of delay(timeunit); function in the loop in order to achieve the animated effect.
Can't seem to find any of it in the free TorqueScript documentation I found. Thanks a lot in advance everyone. :)
#2
%eventID = schedule( timeInMS, ObjID || 0, FunctionName, arg0. .... , argN );
checkIfDone(%eventID);
10/16/2007 (6:12 pm)
Is there a way to determine if the scheduleded function has already been executed? Something like:%eventID = schedule( timeInMS, ObjID || 0, FunctionName, arg0. .... , argN );
checkIfDone(%eventID);
#3
or, in codespeak:
10/16/2007 (6:15 pm)
If %eventID is <= 0, then the event has already occurred. If it is a positive number, it's still pending.or, in codespeak:
if (%eventID > 0)
{
// event is still pending
}
else
{
// event has happened, and been deleted (as an event)
}
#4
10/16/2007 (11:24 pm)
There is also isEventPending( eventID );
#5
@Ehab: Yeah, this is what I'll be needing to check if the event has been executed already.
@everyone: Thanks as always :)
10/17/2007 (5:05 pm)
@Stephen: I guess this would suffice. All I need is something that would halt the main game cycle temporarily in order to let events in.@Ehab: Yeah, this is what I'll be needing to check if the event has been executed already.
@everyone: Thanks as always :)
Torque Owner Ehab Yosry Amer
schedule the function u want to be executed after the time u need in milliseconds.
schedule doesn't work like recursions, meaning that the function calls will not be on top in the stack.
example if u schedule a function after 0 milliseconds it will execute after the function that has scheduled it is finished (just thought to mention that in case u were interested to know :D )
in short schedule will do what u need :D
arg0 to argN are the parameters of the function if any