[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Question about stored variables

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Question about stored variables

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Fraust   (5 posts)  [Biography] bio
Date Sun 19 Jul 2009 11:49 PM (UTC)  quote  ]
Message
Still battling my way through Mushclient from Zmud. Here is my latest problem that I need help with.

I have the follow trigger pattern:

^(?P<location>.*?) \[(?P<dirs>.*?)\]\.

I use this in Zmud to capture the room I'm in and the exits available.

An example of the mud output could be:

Second Level of the Inner Sanctum [e,w,u,d].

How do I go about making these a stored variable, so that when someone on my guild channel fires our location trigger I can just spit back

<channel> I am currently at %<location> with exits: %<dirs>

All your help is appreciated!

Fraust.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 20 Jul 2009 12:05 AM (UTC)  quote  ]
Message
Have you read the page: http://mushclient.com/scripting ?

Anyway, there are a few ways of doing this - with Lua variables or MUSHclient internal world variables. Probably slightly simpler is to use Lua (script) variables, as your location changes so often it doesn't need to be saved as part of your world file.

Below are two triggers that accomplish what you wanted. The first one matches the location information, and simply saves the wildcards into the script variables location and dirs.

The second one, currently set to trigger on "<someone> chats, where are you?" simply chats back with the locations inserted into the message. The ".." operator in Lua concatenates strings together.

To put these examples back into the client, see: http://mushclient.com/pasting


<triggers>

 <trigger
   enabled="y"
   match="^(?P&lt;location&gt;.*?) \[(?P&lt;dirs&gt;.*?)\]\."
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>

location = "%&lt;location&gt;"
dirs = "%&lt;dirs&gt;"

</send>
  </trigger>

  <trigger
   enabled="y"
   match="* chats, where are you?"
   send_to="12"
   sequence="100"
  >
  <send>

Send ("chat I am currently at " .. location .. " with exits: " .. dirs)

</send>
  </trigger>

</triggers>



- Nick Gammon

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

Posted by Fraust   (5 posts)  [Biography] bio
Date Reply #2 on Mon 20 Jul 2009 12:30 AM (UTC)  quote  ]
Message
Thank you for your help Nick. I am actually reading the scripting link that you posted now. Just got to the variable section! It is definitely helping me understand things a little more.
[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.


846 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]