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.
Entire forum
➜ MUSHclient
➜ General
➜ Starting timer with a single command
Starting timer with a single command
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Helium
(2 posts) Bio
|
Date
| Tue 05 Jul 2005 04:40 PM (UTC) |
Message
| I have a timer and i would like to start and stop it by typing commands in the input.
How? I know nothing about scripting | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Tue 05 Jul 2005 07:16 PM (UTC) |
Message
| You can use EnableTimer to turn on and off timers, when you turn them on, you'll also want to use ResetTimer to reset their clock to zero.
You'll want to make an alias to turn it on and off, since that's easier than typing out a long script command.
Something like this (in VBScript):
<aliases>
<alias
match="^enabletimer (on|off)$"
enabled="y"
regexp="y"
send_to="12"
ignore_case="y"
sequence="100"
>
<send>if (StrComp("%1","on",1)) then
EnableTimer "timername", 1
ResetTimer "timername"
Note "timername enabled."
else
EnableTimer "timername", 0
note "timername disabled."
end if</send>
</alias>
</aliases>
Obviously you'll need to either hardcode a 'real' timer name, or make it a wildcard in your alias (but that also requires you to remember the timername), like this:
match="^enabletimer (\w+) (on|off)$"
and then you'll have to change the %1 to %2, and change all the 'timername's to '%1'.
http://www.gammon.com.au/scripts/function.php?name=EnableTimer
http://www.gammon.com.au/scripts/function.php?name=ResetTimer |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Helium
(2 posts) Bio
|
Date
| Reply #2 on Wed 06 Jul 2005 11:19 AM (UTC) |
Message
| Hmm that didn't make much sense to me, sorry.
But i found out how to start / stop timers with
/enabletimer "timer",1
also how to reset them.
however as you said a alias would be cool and i thought
it could be done without even touching scripting
but where shall i send the command?
sending it to world isn't working. | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Wed 06 Jul 2005 07:08 PM (UTC) |
Message
| You can't do it without touching scripting. the enable command requires scripting (thats what your / does).
You'll need to send to script, without the script prefix.
What my trigger does is match on 'enabletimer on', or 'enabletimer off', and then if it's "on" it enables and resets, and if it's "off" it disables. Instead of having to have two aliases. You could hardcode it if you wanted to get around the strcomp by just typing 1 and 0 for on and off, and then just sending that as the argument. And you'd just have to reset everything.
Something like this:
match: ^timeron (\d)
Enabletimer "timername", %1
ResetTimer "timername"
Of course, you could also add the wildcard for the timername. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | 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.
14,247 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top