Timers

Posted by Rynok on Fri 14 Jul 2006 06:31 PM — 3 posts, 14,513 views.

USA #0
I was looking for a way to set a timer to "tick" every 250 milliseconds but only found resources talking about speedwalking and the 1 second lower limit on current timers.

I looked into the speedwalking but what I need is a little bit different than that. Here is my setup I'm hoping to achieve:

Call a script every 250ms which will increment a counter called "Tick". I will then use "Tick" to establish how long it has been since I attempted to do a specific action, and thus if it is time to reset and resend the action or not.

Example:
Command- Drink Health (drinkbal = 0;healthtimer = tick) --This sets it so I remember at which tick I sent the command "drink health"
Trigger- You drink some health (healthtimer = 0)

When the "Timer" function is called by the timer, it will increment "Tick" and then make this check:
if (healthtimer ~= 0 and tick >= healthtimer + 3) then (healthtimer = 0;drinkbal = 1) end

That code should make it so after 3 ticks (750ms) I will resend the command "Drink Health".
Australia Forum Administrator #1
Timers can tick in less than 1 second, like this:


<timers>
  <timer 
    second="0.25"    
    send_to="2"
>
  <send>tick</send>

  </timer>
</timers>

USA #2
Ah, my thanks once again. I had tried using the 0.25 timer thing, but I forgot to configure my Global Preferences to allow for the partial second (it was on 1s intervals instead of 0).