Author Topic: Counting Ticks  (Read 489 times)

How would I count ticks with a playertype? then, everytime a tick goes down, a message is sent to the client. Once after like tick 10, it starts slowly damaging the client. and a item can restore a tick.

(ticks displayed on energy bar in like a playertype.

You have to set up your own tick/schedule loop thing.
So, you have a function that calls itself through the schedule() function every x milliseconds. You'd do stuff in there (as in, this is where your message client, damage the client after a certain amount, item to increase ticks code goes).

Define a function which repeatedly schedules itself to be invoked after a bit of time, passing a constantly increasing number as an argument.
For example:

function foo( %ticks )
{
    cancel( $foo );
    echo( %ticks );
    $foo = schedule( 1000, 0, foo, %ticks++ );
}


This will display a number that increases every second in the console.