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
➜ General
➜ Variables in Timers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Lilbopeep
USA (42 posts) Bio
|
Date
| Wed 09 Sep 2009 05:22 AM (UTC) Amended on Fri 11 Sep 2009 11:08 PM (UTC) by Nick Gammon
|
Message
| Simply put, is it possible? I don't see an 'expand variables' option.
making scrolls on my mud is a tedious, often scripted process, but they are fairly handy to have. My solution was to make an alias that would turn on and off a 3 minute timer, which just about perfect for how long it takes to create the parchment object and write the spell onto it.
This all worked fine and dandy, but it only made scrolls of whatever spell I specified, so I thought.. improve it!
Now, I have an alias:
<aliases>
<alias
match="scrollmaker *"
enabled="y"
expand_variables="y"
send_to="12"
sequence="100"
>
<send>
if "%1" == "off" then
EnableTimer ("scroll_timer", false)
Note ("Turning off the Scroll Timer.")
else
SetVariable("spell", "%1")
EnableTimer ("scroll_timer", true)
Note ("Turning on the Scroll Timer with spell @spell")
end
</send>
</alias>
</aliases>
the off part works fine. But the weird thing is, it seems to be giving the previous variable. If I typed 'scrollmaker blackmantle' it would give me what I typed in before?
Example:
>scrollmaker blackmantle
Turning on the Scroll Timer with spell blackmantle
>scrollmaker shriek
Turning on the Scroll Timer with spell blackmantle
>scrollmaker slow
Turning on the Scroll Timer with spell shriek
This also doesn't even address the problem that my timer isn't doing either of these.
the line that is failing in my alias is:
scribe '@spell'
Also, I am not sure if two word spells are already handled properly - it seems to work in the variable, but I've not been able to get beyond that to make sure.
Any ideas? |
,.~`'~.,Dance Magic Dance,.~`'~., | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 09 Sep 2009 06:31 AM (UTC) |
Message
| Timers don't have an "expand variables" option, but you can do it in scripting, same as in aliases.
Quote:
SetVariable("spell", "%1")
EnableTimer ("scroll_timer", true)
Note ("Turning on the Scroll Timer with spell @spell")
Your problem here is that, when executing a script, MUSHclient replaces @spell by the value in the spell variable *before* executing the code. Thus, changing the variable mid-stream won't affect it. However all you need to do is this:
SetVariable("spell", "%1")
EnableTimer ("scroll_timer", true)
Note ("Turning on the Scroll Timer with spell " .. GetVariable ("spell") )
In this case the GetVariable is executed at runtime, so it will get the right variable. Or, more simply:
SetVariable("spell", "%1")
EnableTimer ("scroll_timer", true)
Note ("Turning on the Scroll Timer with spell %1")
Inside your scroll timer, you can use GetVariable as well. So for example if you wanted to cast "spell" every 5 seconds you could do this:
Send ("cast " .. GetVariable "spell")
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Lilbopeep
USA (42 posts) Bio
|
Date
| Reply #2 on Thu 10 Sep 2009 01:23 PM (UTC) |
Message
| thanks nick! It's working wonderfully! |
,.~`'~.,Dance Magic Dance,.~`'~., | 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.
11,591 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top