Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math


This quick reference guide was taken directly out of The Game Programmer's Guide to Torque by Edward Maurina. It's an outstanding resource - a must for anyone wanting to get serious about programming in Torque.

Contents

Event Scheduling


cancel( eventID )

Purpose
Use the cancel function to cancel a previously scheduled event as specified by eventID.

Syntax
eventID
– The numeric ID of a previously scheduled event.

Returns
No return value.

See Also
getEventTimeLeft, getScheduleDuration, getTimeSinceStart, isEventPending, schedule, obj.schedule



getEventTimeLeft( eventID )

Purpose
Use the getEventTimeLeft function to determine how much time remains until the event specified by eventID occurs.

Syntax
eventID
– The numeric ID of a previously scheduled event.

Returns
Returns a non-zero integer value equal to the milliseconds until the event specified by eventID will occur. However, if eventID is invalid, or the event has passed, this function will return zero.

See Also
cancel, getScheduleDuration, getTimeSinceStart, isEventPending, schedule, obj.schedule



getScheduleDuration ( eventID )

Purpose
Use the getScheduleDuration function to determine how long the event associated with eventID was scheduled for.

Syntax
eventID
– The numeric ID of a previously scheduled event.

Returns
Returns a non-zero integer value equal to the milliseconds used in the schedule call that created this event. However, if eventID is invalid, this function will return zero.

See Also
cancel, getEventTimeLeft, getTimeSinceStart, isEventPending, schedule, obj.schedule

Returns the time in millseconds of the event denoted by eventID as it was originally scheduled.

Returns 0 if eventID is past or invalid.



getTimeSinceStart( eventID )

Purpose
Use the getTimeSinceStart function to determine how much time has passed since the event specified by eventID was scheduled.

Syntax
eventID
– The numeric ID of a previously scheduled event.

Returns
Returns a non-zero integer value equal to the milliseconds that have passed since this event was scheduled. However, if eventID is invalid, or the event has passed, this function will return zero.

See Also
cancel, getEventTimeLeft, getScheduleDuration, isEventPending, schedule, obj.schedule



isEventPending( eventID )

Purpose
Use the isEventPending function to see if the event associated with eventID is still pending.

Syntax
eventID
– The numeric ID of a previously scheduled event.

Returns
Returns true if this event is still oustanding and false if it has passed or eventID is invalid.

Notes
When an event passes, the eventID is removed from the event queue, becoming invalid, so there is no discnerable difference between a completed event and a bad event ID.

See Also
cancel, getEventTimeLeft, getScheduleDuration, getTimeSinceStart, schedule, obj.schedule

$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");

if( isEventPending($Game::Schedule) )  echo(“got a pending event);



schedule( t , objID or 0, functionName, arg0, ... , argN )

Purpose
Use the schedule function to schedule functionName to be executed with optional arguments at time t (specified in milliseconds) in the future. This function may be associated with an object ID or not. If it is associated with an object ID and the object is deleted prior to this event occuring, the event is automatically cancelled.

Syntax
t
– The time to wait (in milliseconds) before executing functionName.
objID – An optional ID to associate this event with.
functionName – An unadorned (flat) function name.
arg0, ... , argN – Any number of optional arguments to be passed to functionName.

Returns
Returns a non-zero integer representing the event ID for the scheduled event.

See Also
cancel, getEventTimeLeft, getScheduleDuration, getTimeSinceStart, isEventPending, obj.schedule

$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");



objID.schedule( t , methodName, arg0, ... , argN )

Purpose
Use the objID.schedule method to schedule methodName to be executed with optional arguments at time t (specified in milliseconds) in the future on the object objID. This event is automatically associated with the object objID, and if that object is deleted prior to this event occuring, the event is automatically cancelled.

Syntax
t
– The time to wait (in milliseconds) before executing methodName.
objID – An ID to associate this event with.
methodName – An unadorned (flat) function name.
arg0, ... , argN – Any number of optional arguments to be passed to methodName.

Returns
Returns a non-zero integer representing the event ID for the scheduled event.

Note
This is one of those rare cases where a method is described in the function appendix, but it really needed to be defined here for clarity.

See Also
cancel, getEventTimeLeft, getScheduleDuration, getTimeSinceStart, isEventPending, schedule

$Game::Schedule = schedule($Game::EndGamePause * 1000, 0, "onCyclePauseEnd");


Section Index


1. OpenAL || 2. Debugging || 3. String Manipulation || 4. Networking || 5. Console || 6. Device I/O || 7. File I/O
8. Packages || 9. Objects || 10. Event Scheduling || 11. Datablocks || 12. Video / Texturing || 13. Special || 14. Resource Management
15. Scene || 16. Containers and Raycasts || 17. Editors || 18. Build || 19. Time || 20. GUIs || 21. Math