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
➜ How to declare a variable inside another variable
|
How to declare a variable inside another variable
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Pokkie
(11 posts) Bio
|
| Date
| Tue 27 Oct 2009 09:22 AM (UTC) Amended on Tue 27 Oct 2009 09:23 AM (UTC) by Pokkie
|
| Message
| Hello all,
I have an alias that lets me recall on Aardwolf, called rec.
My alias goes something like this :
rem @dual_weapon
hold portal
enter
wield @dual_weapon
Now at the moment, @dual_weapon = (123456) but I want to change that to reference another variable, e.g.
@lvl200_dagger = (123456)
@dual_weapon = @lvl200_dagger
However, when my alias runs, then it says it doesn't know what @lvl200_dagger is, instead of seeing its another variable and expanding it.
So my question is, how can I expand a variable inside another variable?
Help much appreciated,
-- pok | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 27 Oct 2009 09:53 AM (UTC) |
| Message
| MUSHclient doesn't recursively expand variables, but you can do it with scripting.
For example:
weapon = GetVariable ("dual_weapon") -- find which weapon (eg. lvl200_dagger)
weapon_id = GetVariable (weapon) -- now find which number it is (eg. 123456)
Send ("rem " .. weapon_id)
Send ("hold portal")
Send ("enter")
Send ("wield " .. weapon_id)
You would set the Send field to "send to script" for this to work.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Pokkie
(11 posts) Bio
|
| Date
| Reply #2 on Tue 27 Oct 2009 11:31 AM (UTC) |
| Message
| It works :)
Thanks alot Nick | | 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.
13,620 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top