Sending multiple commands consecutively

Posted by Atomicoctobot on Tue 31 Mar 2009 07:25 PM — 7 posts, 25,957 views.

#0
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",
},
Australia Forum Administrator #1
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.
Amended on Tue 31 Mar 2009 08:04 PM by Nick Gammon
Australia Forum Administrator #2
Another way is Lua multiple-line strings:


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

#3
Thank you!
Singapore #4
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.
Australia Forum Administrator #5
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]],

Singapore #6
Excellent. Thanks for the clarification, Nick.