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
➜ Using a variable with an alias script
Using a variable with an alias script
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Errigour
USA (32 posts) Bio
|
Date
| Fri 01 Aug 2014 11:14 AM (UTC) Amended on Fri 01 Aug 2014 11:34 AM (UTC) by Errigour
|
Message
| I am trying to do the following but this isn't an accetable format and wildcards(1) returns an error on nil.
The alias is : sanc*
if %1 == nil then
Send("cast 'sactuary' name")
else
Send("cast 'sactuary' %1")
end
| Top |
|
Posted by
| Fiendish
USA (2,534 posts) Bio
Global Moderator |
Date
| Reply #1 on Fri 01 Aug 2014 01:54 PM (UTC) |
Message
|
Quote: wildcards(1) returns an error on nil
wildcards[1]
wildcards is a table, not a function. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| hogarius
USA (22 posts) Bio
|
Date
| Reply #2 on Fri 01 Aug 2014 02:00 PM (UTC) |
Message
| Also, it looks like you misspelled 'sanctuary'.
(and also 'acceptable', but that shouldn't affect your script. :) ) | Top |
|
Posted by
| Fiendish
USA (2,534 posts) Bio
Global Moderator |
Date
| Reply #3 on Fri 01 Aug 2014 02:32 PM (UTC) |
Message
| Also, what is name? Is that meant to be a variable? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Fri 01 Aug 2014 08:04 PM (UTC) Amended on Fri 01 Aug 2014 08:06 PM (UTC) by Nick Gammon
|
Message
| It looks like you are using send-to-script in which case %1 will just be nothing if it doesn't match. So closer to what you want would be:
if "%1" == "" then
Send("cast 'sanctuary' " .. name)
else
Send("cast 'sanctuary' %1")
end
Assuming "name" is a Lua variable with the person's name in it. Otherwise:
Send("cast 'sanctuary' " .. GetVariable ("name"))
Also this one is close to describing what you are doing:
|
- 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.
18,577 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top