Jump to content

Using Timers


McJobless
 Share

Recommended Posts

Firstly, you will Cyrem's NPL Scripter to work with this tutorial, due to its compiler application.

So, looking around in the NPL Scripter, you might notice these things called "Timers", and the fact there seems to be 8 functions to use them. Well, the first rule of Timers is that you can NEVER, EVER use Timer0. Timer0 is used internally by the LegoRR program for some secretive stuff, so you can't go around screwing with that. Always use Timer1, Timer2 or Timer3 (you shouldn't need more than 3 timers).

Before you use a Timer, you need to reset it, otherwise it'll start from some random garbage value you don't want. To reset the timer, simply put in this line:


TRUE ? SetTimer1 0

Basically that statement says "If TRUE (which it will be automatically), Set the value of Timer1 to '0'". Now, after setting it to 0, we can actually use the timer. There are two different things you can do with timers. In the first example, you want to pause the script for a set amount of time; let's say 6000. You would do that like this:

GetTimer1 < 6000 ? Stop

This line essentially says "If the value of Timer1 is less than 6000, wait until it is higher before you do anything else". The other thing we can do is jump to another section of our script when you reach a time limit. If we want to goto the :Party: section of the script, this is how we would define it.

GetTimer1 > 6000 ? :Party

This line says "Once the value of Timer1 is higher than 6000, let's go party". You would then write "Party:" elsewhere to start the :Party: function. You might be interested in setting a specific time on a timer if a certain event occurs, such as a player collecting a crystal. Say you wanted the time to be 500, this is how you would do it:

GetCrystalsCurrentlyStored > 1 ? SetTimer1 500

This line says "If the player has collected a crystal, set Timer1 to 500".

One thing to remember is that timers are always incrementing, so if you need a very accurate timer, remember to reset it in the correct place, otherwise you'll get a false value.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.