[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Simple countdown timer

Simple countdown timer

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


Posted by Kurapiira   (25 posts)  [Biography] 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.

[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

Posted by Kurapiira   (25 posts)  [Biography] 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>

____________________________


[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] 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
[Go to top] top

Posted by Kurapiira   (25 posts)  [Biography] 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!
[Go to top] 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.


15,256 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]