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
➜ Lua
➜ Setvariable
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Mannoman
(7 posts) Bio
|
| Date
| Sun 21 May 2006 12:27 AM (UTC) |
| Message
| I am trying to make an alias to set a variable
set *
world.SetVariable("VarName", %1)
[string "Alias: "]:4: bad argument #2 to `SetVariable' (string expected, got nil)
stack traceback:
[C]: in function `SetVariable'
[string "Alias: "]:4: in main chunk
so ... what should I do? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sun 21 May 2006 01:55 AM (UTC) |
| Message
| If %1 is the word "kobold", then you are doing:
world.SetVariable("VarName", kobold)
The variable kobold will not exist, thus it is nil, thus it is complaining you are using nil where you should have a string.
You want this:
world.SetVariable("VarName", "%1")
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Sun 21 May 2006 06:53 AM (UTC) |
| Message
| There is also an option in triggers and aliases to "send to variable" so you can simply put %1 in the "send" box and send directly to the variable, whose name you specify in the alias dialog.
However I wanted to answer your actual question so you understood the change needed, in case that was part of a larger script. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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,227 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top