How to use Game.Instance.Engine.RealTimeSchedule.Schedule?
by Cosmic Logic · in Torque X 2D · 06/09/2009 (1:34 pm) · 9 replies
There is no documentation or tutorials on the TDN or the official docs that shows how to use this function.
Can anyone point me to a solution or give me a quick tutuorial?
Can anyone point me to a solution or give me a quick tutuorial?
#2
Does it have to be static or can it be a member of a class?
06/12/2009 (10:18 pm)
Thanks, I'll tinker with the method declaration a bit.Does it have to be static or can it be a member of a class?
#3
I'm not sure if I just got spoiled by TGB and torquescript so, I'm not sure if it's possible.
Is it possible to cancel a schedule?
06/15/2009 (8:01 pm)
Thanks again. I've gotten it up and running now. The only thing I'm trying to figure out is cancelling schedules.I'm not sure if I just got spoiled by TGB and torquescript so, I'm not sure if it's possible.
Is it possible to cancel a schedule?
#4
Also, I'd like to know how to pass arguments to the scheduled function.
06/15/2009 (8:25 pm)
That I don't know, but I'd like to.Also, I'd like to know how to pass arguments to the scheduled function.
#5
For passing info into a scheduled delegate function:
06/16/2009 (11:11 am)
for removing the Scheduled task:int iTmp = Game.Instance.Engine.RealTimeSchedule.Schedule(1000, Function); Game.Instance.Engine.RealTimeSchedule.Remove(iTmp);
For passing info into a scheduled delegate function:
Game.Instance.Engine.RealTimeSchedule.Schedule(1000, dostuff, "helllo");
void dostuff(object sender, ScheduledEventArguments scheduleEventArguments)
{
string x = scheduleEventArguments.DataToSend as string;
}
#6
06/16/2009 (11:26 am)
can you only pass 1 argument?
#7
06/16/2009 (11:32 am)
As far as I'm aware. You could wrap several variables up in a class and pass the class as an argument. Hope that helps.
#8
06/16/2009 (11:57 am)
Beautiful. This helps a bunch. Thanks Gavin.
#9
06/16/2009 (12:02 pm)
Most welcome, glad I could actually help :-)
Torque Owner David Horn
so...
Game.Instance.Engine.RealTimeSchedule.Schedule(10000, SpawnBomb);
once that line of code is executed, in 10 seconds, the SpawnBomb function will be called.
Also, the function has to have the arguments:
(object sender, ScheduledEventArguments scheduleEventArguments)
Don't know how to use the scheduleEventArguments, or what they are.