[DOC] How to: Use timers in RAT

Trekkan

JFF Administrator
Staff member
There are times when you would like to fire off specific commands at a time interval, such as outputting some information to Discord, spawn creatures, etc. Please keep in mind that timers are not saved across restarts of RAT. This means that if you setup a timer to run every 6 hours, if you restart RAT, that timer will reset and won't fire for another 6 hours.

There are three commands for timers in RAT, they are:
  • TIMERCREATE
  • TIMERSETSTATUS
  • TIMERREMOVE

and one Event
  • Timer Tick
In order to use a timer, you need to first create it. You do this in a RAT event, so as an example.

Create a new event, of type: Player Any Chat
In the CONDITIONAL section type: STARTSWITH:/mytesttimer
in the script:
.TIMERCREATE:mytimer:60:true​

And save that event
What this does, is when someone types /mytesttimer in the game chat, this will create a new timer called mytimer and it will fire off every 60 seconds, and it is starting up as enabled.

Now create another new event, this time of type: Timer Tick
in the CONDITIONAL section type: TIMER:mytimer
in the SCRIPT section type: /say "Hello everyone, you will see this message every 60 seconds!"

That's all there is to it! You can then pause/unpause or totally delete the timer as well. You can do that by using the TIMERSETSTATUS:<true/false> to enable/disable the timer. Or use TIMERREMOVE:mytimer to delete the timer, which means you'll need to use the CREATETIMER again if you want the timer later.
 
Top