Dark_Marine_123 Posted December 29, 2008 Author Share Posted December 29, 2008 Got a little problem with this here ScriptGetTickCount()Now if Im correct, this is the timer that runs most of the Hardcoded stuff (I saw it everywhere in the source), but how would it work in the script. Could I get an example of its usage? Link to comment Share on other sites More sharing options...
Lamagod Posted December 29, 2008 Share Posted December 29, 2008 I've seen this in the elysium soruce as well.I tried the exact same thing as you, but could never get it to work.I don't think it is possible, because some hardcode just cannot be used in script. Link to comment Share on other sites More sharing options...
DarkMazer Posted December 29, 2008 Share Posted December 29, 2008 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 IfEnd SubSub 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 More sharing options...
Dark_Marine_123 Posted December 29, 2008 Author Share Posted December 29, 2008 I love you ;oIt works better than I thought it could, now I can do timers and stuff ^_^ Link to comment Share on other sites More sharing options...
DarkMazer Posted December 30, 2008 Share Posted December 30, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now