Game Development Community

Pausing schedules?

by Cinder Games · in Torque Game Engine · 06/03/2006 (2:04 pm) · 4 replies

I gotta figure out how to pause every pending scheduled event.

I know that the schedules are stamped with a timestamp, so it's just not as easy as stopping the schedule checking....

Was curious if anyone has any suggestions or insight for me as i begin to add this into the source. Course when, i'm done, i'll post that code here for others as well.

Can someone tell me exactly where this check occurs for schedules? I know its in the Sim related CC files but i've looked them over and can't tell exactly where it's happening.

#1
06/03/2006 (4:15 pm)
There are functions in the engine already which deal with this kind of stuff.

By using them in combination, it's possible to do what you want without code changes.

1. cancelAll - Cancels all schedules.
2. getEventTimeLeft - Get's you the time left on the schedule, until it triggers.

By using these, you can easily make a function which cancels all schedules, and store their time left in a list. Then when you want to unpause, you simply re-schedule the list again with the time that was left on each schedule, when you paused the game.

Simple!
#2
06/03/2006 (4:28 pm)
:) thanks for the reply.


What i'm concerned about is the arguments that the events carry.

I'd like to recreate them all with the same arguments that they had. I'm unsure how to retrieve what was passed to them.

I'm creating my schedules and not keeping track of everything.

I am currently writing a script prototype to keep track of my schedules and what not.
But i'd prefer to actually access the current event queue and go from there.
#3
06/03/2006 (4:30 pm)
I see. Let us know if you find anything useful :)
#4
06/03/2006 (4:34 pm)
I will. I'm gonna try to do something along the lines of adding an offset time based on when i start the pausing to determine if a schedule should be called or not...


psuedo code

if (Pausing){
    if currenttime - TimePaused == event->time
    process->event
}
else
    if currenttime == event->time
    process->event
}

i'm just not certain where this particular check is occuring :)