Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Message
| It took a bit of mucking around to paste that into my copy of the client. Please follow the instructions below next time to make a copy of your trigger:
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
In particular the "match" lines didn't work because they had imbedded quotes:
match="(?s)^(Web)\:\s+\w+\s+says\,\s+"\s+NAME\s+.\s+(\w+)\s+"\.\Z"
If you had simply clicked the "copy" button they would have been converted to " for you.
- The first thing I will change is to get rid of "(?s)" from your trigger match. That is the "dot matches all" option which only applies to multi-line triggers (which might have a newline in them).
- Similarly the "\Z" is only for multi-line triggers, really. To match the end of a single-line trigger you just need "$".
- You said you would see: (Web): Someone says, "Jack - COLOUR."
However in your trigger you have NAME - is this supposed to be Jack, or what?
- You haven't said what language you are using, but if it is Lua then you need to put function arguments in quotes, except in certain limited circumstances. That is, change:
ColourNote "crimson", "silver", "Switching to %1"
to:
ColourNote ("crimson", "silver", "Switching to %1")
- You are doing "send to output", so if the trigger matches, it simply prints on the screen:
secure bastard
bowstance
switch green
ColourNote "crimson", "silver", "Switching to green"
This isn't what you want, I presume. You want to DO these things, not just put them on the screen.
However to do things like the ColourNote you need to send to "script", however in that case you can't mix script commands with things to go to the MUD. In other words, it needs to look like this:
Send ("secure bastard")
Send ("bowstance")
Send ("switch %1")
ColourNote ("crimson", "silver", "Switching to %1")
So, with those things fixed up, the triggers looks like this:
<triggers>
<trigger
enabled="y"
match="^\(Web\): \w+ says, "Jack \- (\w+?)\."$"
regexp="y"
send_to="12"
sequence="100"
>
<send>
Send ("secure bastard")
Send ("bowstance")
Send ("switch %1")
ColourNote ("crimson", "silver", "Switching to %1")
</send>
</trigger>
<trigger
enabled="y"
match="^\(Web\): \w+ says, "(.*?) is our target to the (\w+?)\."$"
regexp="y"
send_to="12"
sequence="100"
>
<send>
SetVariable ("target", "%1")
ColourNote ("deepskyblue", "black", "Target: %1")
SetVariable ("direction", "%2")
ColourNote ("green", "black", "Dir: %2")
</send>
</trigger>
</triggers>
 |
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 |
|