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
➜ Proper format when sending a variable
|
Proper format when sending a variable
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| EMP Fingers
(2 posts) Bio
|
| Date
| Wed 13 May 2015 02:43 AM (UTC) |
| Message
| I've been setting up several triggers to practice engraving items with a tool but am unsure of how to call out the variable for them.
Upon matching it sends this to script:
Send ("engrave "..GetVariable("EngraveItem").." with tool")
Send ("test")
So if I'm engraving a hat all I need to do is set my EngraveItem variable to hat.
engrave hat with tool
(the game prompts me for what I wish to engrave)
test
What I don't understand is why I need the two periods before and after the GetVariable function. I don't see where in the function descriptions it calls out needing to use them in order for the function to work while I've been browsing. If someone could explain or point me in the right direction I'd appreciate it. |
III | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 13 May 2015 06:36 AM (UTC) |
| Message
| Please post your exact trigger.
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
You probably don't need scripting at all here. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Wed 13 May 2015 06:40 AM (UTC) |
| Message
|
Quote:
What I don't understand is why I need the two periods before and after the GetVariable function.
The quick answer, though, is that the two dots is the Lua way of concatenating strings. So for example:
Would put "foobar" into x. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| EMP Fingers
(2 posts) Bio
|
| Date
| Reply #3 on Wed 13 May 2015 07:27 PM (UTC) |
| Message
| <triggers>
<trigger
enabled="y"
match="Oxytocin starts grinding an inscription into his * with an engraving tool."
send_to="12"
sequence="100"
>
<send>Send ("engrave "..GetVariable("EngraveItem").." with tool")
Send ("asfs")</send>
</trigger>
</triggers>
The only reason I use scripting is because this is one in a set of a couple triggers and timers I use to improve my crafting skill. This ques up another engrave command after the first one.
For this trigger specifically I could just call %1 with the same result but it's not always applicable for everything else, so rather than needing to change every instance of "hat" to "pants" when I finish my hats, I can just use the variable in everything and change the variable when I finish.
Thank you, Nick. I had been trying to figure that out for a while. Do you have any idea which forum page it's explained on off the top of your head? Just for later reference would be appreciated. If not thanks for explaining it to me! |
III | | Top |
|
| Posted by
| Nick Gammon
Australia (23,166 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Wed 13 May 2015 07:58 PM (UTC) |
| Message
| I don't think I document all the operators in the language (like + * / -). The .. operator is one such. However the online book Programming in Lua is very good.
Concatenation is mentioned here: 3.4 – Concatenation
The rest is worth reading (particularly the earlier parts) because he also describes how string constants work, comparisons, etc. |
- 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.
17,956 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top