Trigger/Timer Assistance

Posted by Narcs on Tue 12 Mar 2019 05:02 PM — 4 posts, 16,804 views.

United Kingdom #0
Hello! Returned to MUDs after a while and trying to set something up for one of my games.

I want to trigger a timer to run after a certain action, which will create a notification after so long:

_____________________
Trigger:



  <trigger
   custom_colour="9"
   enabled="y"
   make_italic="y"
   make_underline="y"
   match="*Thaum cast begun!*"
   name="ThaumTick"
   send_to="12"
   sequence="100"
  >
  <send>EnableTimer("ThaumTimer", true)</send>
  </trigger>


Timer:



  <timer name="ThaumTimer" enabled="y" minute="7" second="0.00" offset_second="0.00"    send_to="12"
>
  <send>Sound ("250770__ninafoletti__river-waterfall-2.wav")
ColourNote ("#9932CC", "black", "GP is filled up and ready to go!")
FlashIcon ()
EnableTimer("ThaumTimer", false)</send>

  </timer>


_____________________

If I run this, it will work fine and as expected, will trigger the timer to be enabled and then display/play the notifications and disabled the timer after 7 minutes. If I run again, the timer runs immediately. Run a third time, works as expected.

Anyone able to point out what I'm doing wrong? Probably something glaring..

Thanks in advance.
Amended on Wed 13 Mar 2019 02:52 AM by Nick Gammon
USA Global Moderator #1
Reset the timer after you enable it in your trigger.

You should also set enabled="n" in the timer so that it doesn't run when you start up mushclient.
Amended on Tue 12 Mar 2019 10:22 PM by Fiendish
United Kingdom #2
Nice one bud, added a reset to the trigger action, after it enables and that sorted the job!
Australia Forum Administrator #3
Also see this:

Template:function=ResetTimer
ResetTimer

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



You have to enable it before resetting it.

I mention this because other people reading this thread may not have realized the significance of the order of doing things.