How to integrate script/triggers

Posted by Jenasta on Thu 07 Jan 2010 12:37 PM — 2 posts, 12,731 views.

#0
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:


Australia Forum Administrator #1
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.