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 ➜ Getting Started ➜ Video discussing client and script variables

Video discussing client and script variables

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


Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Thu 30 Dec 2010 05:19 AM (UTC)

Amended on Mon 25 Nov 2013 10:44 PM (UTC) by Nick Gammon

Message
I have made a video discussing both client and script variables, how you might create them, and how you could use them.




- Nick Gammon

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

Posted by Seriley   (42 posts)  Bio
Date Reply #1 on Thu 30 Dec 2010 07:57 PM (UTC)
Message
Excellent presentation and a good review, Nick
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 30 Dec 2010 08:47 PM (UTC)

Amended on Thu 30 Dec 2010 08:48 PM (UTC) by Nick Gammon

Message
Thanks!

Below are the aliases I described, in case they are hard to read in the video:


<aliases>

  <alias
   match="f"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>
Send (left_direction)
</send>
  </alias>

  <alias
   match="k"
   enabled="y"
   expand_variables="y"
   sequence="100"
  >
  <send>kick @target</send>
  </alias>

  <alias
   match="t *"
   enabled="y"
   variable="target"
   send_to="9"
   sequence="100"
  >
  <send>%1</send>
  </alias>

</aliases>


Here are the triggers:


<triggers>

  <trigger
   custom_colour="2"
   enabled="y"
   match="* arrives from the *."
   send_to="12"
   sequence="100"
  >
  <send>

target = "%1"
direction = "%2"

</send>
  </trigger>

  <trigger
   custom_colour="6"
   enabled="y"
   match="* leaves *."
   send_to="12"
   sequence="100"
  >
  <send>

target = "%1"
left_direction = "%2"

</send>
  </trigger>

  <trigger
   enabled="y"
   expand_variables="y"
   match="@target punches you"
   sequence="100"
  >
  </trigger>

</triggers>


And here are the variables:


<variables>

  <variable name="last_direction">east</variable>

  <variable name="tank">edward</variable>

  <variable name="target">carrion crawler</variable>

</variables>



Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


- Nick Gammon

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

Posted by Mahony   (27 posts)  Bio
Date Reply #3 on Sun 17 Aug 2014 04:50 PM (UTC)

Amended on Thu 21 Aug 2014 07:44 PM (UTC) by Mahony

Message
HI
Are there some default client variables? Like for the last command sent (or last 3 commands)
In zmud it was %lastcom
Is there a list of all default variables?
thanx
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 17 Aug 2014 08:17 PM (UTC)
Message
There are no default variables, however quite a lot of functions that return things. For the last command, for example:

Template:function=GetCommandList GetCommandList

The documentation for the GetCommandList script function is available online. It is also in the MUSHclient help file.



An argument of 1 returns the most recent command.

Look at the function list (Ctrl+Alt+Shift+L) and type "get" into the filter window to see quite a few of them.

Some of them (like GetInfo) have a selector (argument) that returns a lot of things about the current client state, such as the world file name, log file name, how many triggers have fired, and so on.

Template:function=GetInfo GetInfo

The documentation for the GetInfo script function is available online. It is also in the MUSHclient help file.


- Nick Gammon

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

Posted by Mahony   (27 posts)  Bio
Date Reply #5 on Sun 17 Aug 2014 10:37 PM (UTC)
Message
Oh great. Thanx. GetInfo(87) works fine for me.

Now a general problem with using stuff from functions like this.
Im trying this
Send("open" GetInfo(87))
and it doesn't work. Tried moving the apostrophes and brackets all possible ways... :)

How to do it? GetInfo(87) returns "up" in my case.

Thank you
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 17 Aug 2014 10:51 PM (UTC)
Message
You need to read up on Lua and how it handles strings. To concatenate (join) them you use two dots, eg.


 Send("open" .. GetInfo(87))

- 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.


30,519 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.