TorqueScript Console Functions 19

From TDN

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.

Time

getRealTime()

Purpose
Use the getRealTime function to get the computer time in milliseconds.

Returns
Returns the current real time in milliseconds.

See Also
getSimTime

Used to get the real time (in milliseconds)
Returns a numeric

echo("Time in milliseconds: " @ getRealTime() );
// print example:
// Time in milliseconds: 5939562



getSimTime()

Purpose
Use the getSimTime function to get the time, in milliseconds, that has elapsed since the engine started executing.

Returns
Returns the time in milliseconds since the engine was started.

See Also
getRealTime

function timeMetricsCallback()
{
  return fpsMetricsCallback() @ 
         "  Time -- " @ 
         "  Sim Time: " @ getSimTime() @ 
         "  Mod: " @ getSimTime() % 1000;
}

2nd example:

echo(
   ":" @ 
   fpsMetricsCallback() @ 
   "  Time -- " @ 
   "  Sim Time: " @
   getSimTime() @ 
   "  Mod: " 
   @ getSimTime() % 1000 @ 
   ":"
);
// print example:
// : FPS: 136.6  mspf: 7.32064  Time --   Sim Time: 1974918  Mod: 918:


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