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, 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.
 Entire forum ➜ MUSHclient ➜ General ➜ Simple countdown timer

Simple countdown timer

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


Posted by Kurapiira   (25 posts)  Bio
Date Wed 02 Mar 2011 08:30 AM (UTC)
Message

Hi,
Sorry, i have no clue how to do this.

I need a simple countdown timer , We have gladiator games, and we need a timer to count off the seconds till the Kill command. I use an alias in zmud ..countdown 30

in Zmud it looks like this:

alias: countdown *
Value:

#IF (%1) {count = %1} {count = 10}
#WHILE (@count > 0) {
chant @count
#WAIT 1000
#ADD count -1
}

I've tried , but don't know enough about mush to do this.
Any help for this please?
Thank you,
K.

Top

Posted by Nick Gammon   Australia  (23,052 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 03 Mar 2011 12:04 AM (UTC)
Message
Something like this will do it:


<aliases>
  <alias
   match="^countdown (\d+)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>

require "wait"

wait.make (function ()

  for counter = 30, 1, -1 do
    Send ("chant " .. counter)  -- send message
    wait.time (1)  -- wait one second
  end -- for

end )  -- end coroutine

</send>
  </alias>
</aliases>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

- Nick Gammon

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

Posted by Kurapiira   (25 posts)  Bio
Date Reply #2 on Thu 03 Mar 2011 04:46 AM (UTC)
Message

wow..amazing ! thank you SO much!
i changed it just a bit,(counter=%1) and was trying to modify it for the end message, but couldn't figure out how to do that. I'd like to have a send command happen at the end of the countdown...Send("say Begin Fighting!"), but couldn't figure out how to put it in there...

Thank you very much for any help :)


__________________________

<aliases>
<alias
match="^countdown (\d+)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>

require "wait"

wait.make (function ()
Send("say The Countdown Begins!")

wait.time (2)

for counter = %1, 1, -1 do
Send ("chant " .. counter) -- send message
wait.time (1) -- wait one second
end -- for


end ) -- end coroutine


</send>
</alias>
</aliases>

____________________________


Top

Posted by Nick Gammon   Australia  (23,052 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 03 Mar 2011 06:43 AM (UTC)
Message
Kurapiira said:

i changed it just a bit,(counter=%1) ...


Oh yes, oops. You were right.

As for the end message:


for counter = %1, 1, -1 do
  Send ("chant " .. counter) -- send message
  wait.time (1) -- wait one second
end -- for

Send ("say Begin Fighting!")



That's all there is to it.

- Nick Gammon

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

Posted by Kurapiira   (25 posts)  Bio
Date Reply #4 on Thu 03 Mar 2011 09:01 AM (UTC)
Message

Thanks again Sooo much, i tried that, but must have
done it wrong..it's working fine now :)
Cheers!
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.


16,351 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.