Home:
  - News
  - Archives
  - Site Info
  - Mirage

Game Play:
  - Tips
  - Tricks
  - Moves
  - Cheats
  - Fun

Game Tech:
  - Playing
  - Oni Works
  - AI Dev

Dev Shed:
  - Script Lib
  - Sepics
  - Tool Kit
  - Downloads

Community:
  - Board
  - Links
  - Contests

Directory: Technical >> Script Lib >> Basics >> Timers.

Using Timers:

Timers are very easy. To start a timer, use the following line:

   timer_start [time] [function]

where time is measured in seconds. When the timer reaches 0, the function is activated. The timer function is "forked" since the lines of code after it still run during the countdown.

When the timer countdown is finished it should be stopped by: (this is usually done in the function that the timer executes).

   timer_stop

You may only have one Timer at a time. If you try to start a timer when a timer is on both the old and new timer will end when the new timer will end. Suppose, originally I set a timer for 10 seconds and 5 seconds later I set a timer for 15 seconds in the other fork, both forks will resume after 15 seconds not depending on the previous 10 seconds.

If you call timer_stop it stops the timer even if it is in a different fork.

The way, Timer Arena's work is that we have a sequence of timer's and bodies, i.e timers one after another. When a timer ends, guys and weapons could be spawned. You can fork timers one though another.

Lets consider an example of a timer, similar to the one at the end of level 1.

   var bool death_counter=1;

   func void do_you_die (void)
   {

     if (death_counter eq 1)
     {
       lose
     }
   
   }
   
   func void [running_function] (void)
   {
     timer_start 100 do_you_die
   }
   
   func void level4a (void)
   {
     death_counter=0
   }

Basically, if you are unable to execute the function level4a (through console) you lose. { lose } makes you lose the level.



© 2001-2004 by Oni Master. All rights reserved.
We are not affiliated with Bungie Studios nor Rockstar Games.