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 ➜ timer fires right away when enabled

timer fires right away when enabled

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


Posted by Shwick   (21 posts)  Bio
Date Sun 30 May 2010 07:08 AM (UTC)

Amended on Sun 30 May 2010 07:46 AM (UTC) by Shwick

Message
I have a timer already created in my plugin with xml, and when I enable it in my script it fires immediately.

How can I make it fire after 15 seconds when enabled?


<timer name="rootNodeTimer" script="rootNodeTimerScript" second="15.00" offset_second="0.00" >
</timer>


I tried changing offset to 15, also tried seconds to 30 and offset to 15.

Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 30 May 2010 09:34 AM (UTC)
Message
Reset the timer immediately after enabling it. Otherwise it will have passed its fire time some time back.

Template:function=ResetTimer ResetTimer

The documentation for the ResetTimer script function is available online. It is also in the MUSHclient help file.



- Nick Gammon

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

Posted by Shwick   (21 posts)  Bio
Date Reply #2 on Sun 30 May 2010 10:03 PM (UTC)
Message
k thanks that works for me

what exactly does the timer offset do, i haven't seen it clearly defined anywhere
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 31 May 2010 12:24 AM (UTC)
Message
Say you wanted to do this:


sing 
(wait 10 seconds)
dance
(wait 10 seconds)
laugh
(wait 10 seconds)
sing 
(wait 10 seconds)
dance
(wait 10 seconds)
laugh
(wait 10 seconds)


... and repeat that.

Now you sing every 30 seconds (ditto for dance and laugh) but if you put them all on a 30-second timer, you would get:


sing / dance / laugh
(wait 30 seconds)


To fix this you have them all on 30-second timers, but dance has a 10-second offset, and laugh has a 20-second offset.

Effectively the offset is the distance "into" the timer interval that the timer fires.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


14,622 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.