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 ➜ General ➜ How to integrate script/triggers

How to integrate script/triggers

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


Posted by Jenasta   (4 posts)  Bio
Date Thu 07 Jan 2010 12:37 PM (UTC)
Message
I'm trying to fiqure out how to capture data from a trigger, and save variables that I can use. My code looks like:


<triggers>
  <trigger
   enabled="y"
   match="^You say, "refill \d+ \D+\."$"
   send_to="12"
   sequence="100"
  >
  <send>

require "var"

var.vialnum = %1
var.vialtype = %2

</send>
  </trigger>
</triggers>



I found this post, which seems to do close to what I need:
http://www.mushclient.com/forum/?id=9935&page=999

and I also read about importing the XML. The problem is, do I leave the entire <Triggers></Triggers> in the script file? And if I do, do I need to append anything before it, or can I just copy exactly what is there to my script, and then paste the trigger into MUSH. If I paste that into my script file, which is currently empty, and then I import the trigger, I recieve the error:
Quote:

Compile error
World: Aetolia
Immediate execution
[string "Script file"]:1: unexpected symbol near '<'
Error context in script:


Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 07 Jan 2010 06:56 PM (UTC)

Amended on Tue 26 Nov 2013 03:41 AM (UTC) by Nick Gammon

Message
See:

http://www.gammon.com.au/scripting


For what you have shown so far, you don't need a script file, everything is done within the trigger.

BTW, in your trigger, you need to "capture" things for them to become wildcards, so it would want to look more like:


match="^You say, "refill (\d+) (\D+)\."$"


Also, you can see you are going to have a problem with quotes. Are you hand-typing this? You should use the GUI interface to make a trigger, that will simplify things somewhat.

Take a look at some of the videos I made recently, they show a lot of what you need.

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


12,297 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.