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
➜ VBscript
➜ Reboot Countdown
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Xavaier
USA (26 posts) Bio
|
| Date
| Fri 31 May 2002 02:10 AM (UTC) |
| Message
| I'm looking for a way to create a countdown for reboot on my mud so when I prepare to reboot I can give a 5 minute warning to everyone on the mud using Gecho.
How could this be done? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 31 May 2002 02:43 AM (UTC) |
| Message
| | Do you mean a warning every minute? Can you give an example? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Xavaier
USA (26 posts) Bio
|
| Date
| Reply #2 on Fri 31 May 2002 02:49 AM (UTC) |
| Message
| Well like this:
gecho This mud will be rebooted in 5 minutes
gecho this mud will be rebooted in 2 minutes
gecho this mud will be rebooted in 1 minute
gecho this mud will be rebooted in 30 seconds
gecho this mud will be rebooted in 10 seconds
gecho 5 seconds to reboot
gecho 4 seconds to reboot
gecho 3 seconds to reboot
gecho 2 seconds to reboot
gecho 1 second to reboot
reboot
Well, with the time delays ofcourse.. btw, thanks for the quick reply!! | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Fri 31 May 2002 03:27 AM (UTC) |
| Message
| I would make an alias that calls a script that does a few 'doafter's, like this:
sub OnShutdown (sName, sLine, wildcards)
world.send "gecho This mud will be rebooted in 5 minutes"
' 3 minutes later ...
world.doafter 180, "gecho This mud will be rebooted in 2 minutes"
' 4 minutes later ...
world.doafter 240, "gecho This mud will be rebooted in 1 minute"
' 4 mins 30 seconds later ...
world.doafter 270, "gecho This mud will be rebooted in 30 seconds"
' 4 mins 50 seconds later ...
world.doafter 290, "gecho This mud will be rebooted in 10 seconds"
' 4 mins 55 seconds later ...
world.doafter 295, "gecho This mud will be rebooted in 5 seconds"
' 4 mins 56 seconds later ...
world.doafter 296, "gecho This mud will be rebooted in 4 seconds"
' 4 mins 57 seconds later ...
world.doafter 297, "gecho This mud will be rebooted in 3 seconds"
' 4 mins 58 seconds later ...
world.doafter 298, "gecho This mud will be rebooted in 2 seconds"
' 4 mins 59 seconds later ...
world.doafter 299, "gecho This mud will be rebooted in 1 second"
' reboot! ...
world.doafter 300, "reboot mud now"
end sub
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Xavaier
USA (26 posts) Bio
|
| Date
| Reply #4 on Fri 31 May 2002 03:45 AM (UTC) |
| Message
| | Thanks Nick, Worked like a charm! | | Top |
|
| Posted by
| Shadowfyr
USA (1,792 posts) Bio
|
| Date
| Reply #5 on Fri 31 May 2002 08:13 PM (UTC) |
| Message
| if your mud has an 'uptime' like command that tells you when the next reboot will happen anyway, then maybe something like I did would be useful too:
Set a trigger to pull the days, hours, minutes and seconds till reboot from the uptime and call a Rebtimer script (Make this a perm trigger, since it could be useful to reset the time if something happens like a dropped connection). Add you uptime command to the list of things done when the mud connects, then add these routines and a timer-
Timer: 1 second interval
Calls: Distime
sub Rebtimer (trigname, output, wildcards)
world.setvariable "Days", wildcards(1)
world.setvariable "Hours", wildcards(2)
world.setvariable "Minutes", wildcards(3)
world.setvariable "Seconds", wildcards(4)
world.status "Reboot is in " & wildcards(1) & "d " & wildcards(1) & "h " & wildcards(1) &"m."
end sub
sub Distime (Timername)
int a
int b
int c
int count
a = Cint(world.getvariable("Days"))
b = Cint(world.getvariable("Hours"))
c = Cint(world.getvariable("Minutes"))
d = Cint(world.getvariable("Seconds"))
d = d - 1
for count = 1 to 1
if d < 0 then
c = c - 1
if c < 0 then
b = b - 1
if b < 0 then
a = a - 1
if < 0 then
a = 0
b = 0
c = 0
d = 0
exit for 'Cheat since there is no goto and we can't simply exit sub. ;)
end if
b = 23
end if
c = 59
end if
d = 59
end if
next
world.setvariable "Days", a
world.setvariable "Hours", b
world.setvariable "Minutes", c
world.setvariable "Seconds", d
world.status "Reboot is in " & a & "d " & b & "h " & "m."
if a = 0 and b = 0 then
if c < 6 then
if c > 0 then
world.send "gecho This mud will be rebooted in " & c & " minutes!"
else
if d = 30 or d <= 10
world.send "gecho This mud will be rebooted in " & d & " seconds!"
end if
end if
end if
end sub
This should produce the same results, but also gives you a running timer in the bottom left of MUCHClient telling you how long to the minute that you have left. I considered timing it to the second to be somewhat pointless anyway, so on mine I don't keep track of the seconds, but just round up a minute if there are more than 30 seconds in that field. This also makes elimination of the 'if d then' part and simplifies the gecho section, but if the mud doesn't care about you spamming it every second for the last 10, then go for it. ;) lol
------
This code does not carry a warrenty whether explicit or implied that it will work for any specfic purpose, including that for which it was designed. And by the way you really should have read these instructions 'before' opening the box... ;) | | 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.
26,801 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top