[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Using a variable with an alias script
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Using a variable with an alias script

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Errigour   (26 posts)  [Biography] 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
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] 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
[Go to top] top

Posted by hogarius   USA  (22 posts)  [Biography] 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. :) )
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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"))


Template:faq=32 Please read the MUSHclient FAQ - point 32.


Also this one is close to describing what you are doing:

Template:faq=50 Please read the MUSHclient FAQ - point 50.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Errigour   (26 posts)  [Biography] bio
Date Reply #5 on Mon 04 Aug 2014 12:34 PM (UTC)
Message
Thanks!
[Go to top] 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.


3,321 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]