Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Timers

Timers

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Rynok   USA  (25 posts)  Bio
Date Fri 14 Jul 2006 06:31 PM (UTC)
Message
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".
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 14 Jul 2006 11:27 PM (UTC)
Message
Timers can tick in less than 1 second, like this:


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

  </timer>
</timers>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Rynok   USA  (25 posts)  Bio
Date Reply #2 on Sat 15 Jul 2006 02:36 AM (UTC)
Message
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).
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,092 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.