Simple countdown timer

Posted by Kurapiira on Wed 02 Mar 2011 08:30 AM — 5 posts, 22,883 views.

#0

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.

Australia Forum Administrator #1
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.
#2

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>

____________________________


Australia Forum Administrator #3
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.
#4

Thanks again Sooo much, i tried that, but must have
done it wrong..it's working fine now :)
Cheers!