Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

ScriptGetTickCount()


Dark_Marine_123
 Share

Recommended Posts

Function ScriptGetTickCount() just returns how many ticks (milliseconds) have passed since either the computer or the server started up (can't remember which off the top of my head).  Let's see if I can make an example…

```
Sub Boom(index)
    If Int(GetVar("ticks.ini", GetPlayerName(index), "Ticks")) + 5000 > ScriptGetTickCount() Then
        Call PlayerMsg(index, "Wait longer", RED)
    Else
        Call PlayerMsg(index, "BOOM!", YELLOW)
        Call TickStore(index)
    End If
End Sub

Sub TickStore(index)
    Call PutVar("ticks.ini", GetPlayerName(index), "Ticks", ScriptGetTickCount())
End Sub

```Now, if you ignore any annoying, reasonless bugs that might be present, that should work.  Basically, Sub Boom will say "Boom!" when called, but only if it's been 5 seconds since it was last called.  Otherwise, it'll say "Wait longer". 

Anyways, if that doesn't work, try using ScriptGetTickCount instead of ScriptGetTickCount().  I'm not exactly an expert on proper syntax.
Link to comment
Share on other sites

You're welcome :cool:

There's already a built-in timer feature (see http://www.touchofdeathforums.com/smf/index.php?topic=16378.0).  There's also a GetTimer("name of timer") command not covered in there that returns how many milliseconds until the timer executes.  This kind of timer executes something after a delayed amount of time (like an attack that takes effect 2 seconds later, or removing the effects of a buff spell after 1 minute). 

The main reason I can see to use ScriptGetTickCount is to allow someone to do something only once in a certain amount of time (like a cool-down time).  Still, many MMORPGs use cool-down timers, and there are many uses for them.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...