[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]  Proper format when sending a variable
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Proper format when sending a variable

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


Posted by EMP Fingers   (2 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 13 May 2015 06:36 AM (UTC)
Message
Please post your exact trigger.

Template:copying 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
[Go to top] top

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


x = "foo" .. "bar"


Would put "foobar" into x.

- Nick Gammon

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

Posted by EMP Fingers   (2 posts)  [Biography] 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
[Go to top] top

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


2,343 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]