Register forum user name Search FAQ

Gammon Forum

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 ➜ Sending multiple commands consecutively

Sending multiple commands consecutively

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


Posted by Atomicoctobot   (19 posts)  Bio
Date Tue 31 Mar 2009 07:25 PM (UTC)
Message
I need to send "get shield" immediately after "stop", but I can't work out how the second command needs to be added in.

Help?

-- button 2
{
icon = "stopgetshield.png",
tooltip = "STOP/GET SHIELD",
send = "stop",
},
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 31 Mar 2009 08:03 PM (UTC)

Amended on Tue 31 Mar 2009 08:04 PM (UTC) by Nick Gammon

Message
Simplest way is to build in a linebreak:


-- button 2
{
icon = "stopgetshield.png",
tooltip = "STOP/GET SHIELD",
send = "stop\nget shield",
},


The character \n is a "newline" which means it turns the string into multiple lines. Put as many of those in as you need.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 31 Mar 2009 08:06 PM (UTC)
Message
Another way is Lua multiple-line strings:


-- button 2
{
icon = "stopgetshield.png",
tooltip = "STOP/GET SHIELD",
send = [[
stop
get shield]],
},


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Atomicoctobot   (19 posts)  Bio
Date Reply #3 on Tue 31 Mar 2009 08:21 PM (UTC)
Message
Thank you!
Top

Posted by noident   Singapore  (3 posts)  Bio
Date Reply #4 on Tue 16 Jun 2009 01:36 AM (UTC)
Message
Sorry for dragging up an older post. Referring the code snippet:

-- button 2
{
icon = "stopgetshield.png",
tooltip = "STOP/GET SHIELD",
send = [[
stop
get shield]],
},

How would I add another command after 'get shield' which was already a pre-defined alias please?

I currently use Execute; Does that mean I need to leave the Send and issue the Execute?

Thanks.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 16 Jun 2009 07:34 AM (UTC)
Message
The commands are sent to Execute, and thus aliases will be captured.

So if your alias was "blah" just change it to:


send = [[
stop
get shield
blah]],


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by noident   Singapore  (3 posts)  Bio
Date Reply #6 on Tue 16 Jun 2009 11:14 AM (UTC)
Message
Excellent. Thanks for the clarification, 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.


19,066 views.

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

Go to topic:           Search the forum


[Go to top] top

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