| Message |
It would help if you simply pasted the XML from the trigger rather than explaining it piece by piece.
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
Your problem is that inside the Send box, MUSHclient pre-processes backslash sequences, so that \s won't be sent to the rex.new.
re = rex.new([[^(t|te|tel|tell)\s+(\S+)\s+do\s+(.+)$]])
You need to defeat that by doubling the backslashes, this worked for me:
<triggers>
<trigger
enabled="y"
match="^God tells you: "do (?<order>.+)"$"
regexp="y"
send_to="12"
sequence="110"
>
<send>
re = rex.new([[^(t|te|tel|tell)\\s+(\\S+)\\s+do\\s+(.+)$]])
s,e,t = re:match("%<order>")
print("%<order>")
print(s,e,t)
</send>
</trigger>
</triggers>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
If this is confusing, use a script file and put the name of a function in the "Script" box of the trigger, and have the function in your script file. Then you don't need to double the backslashes.
For example:
<triggers>
<trigger
enabled="y"
match="^God tells you: "do (?<order>.+)"$"
regexp="y"
script="mytrigger"
sequence="110"
>
</trigger>
</triggers>
And in your script file:
function mytrigger (name, line, wildcards)
re = rex.new([[^(t|te|tel|tell)\s+(\S+)\s+do\s+(.+)$]])
s,e,t = re:match(wildcards.order)
print(wildcards.order)
print(s,e,t)
-- debugging
require "tprint"
tprint (t)
end -- function mytrigger
Output:
God tells you: "do tell me do kill"
tell me do kill
1 15 table: 03917CC0
1="tell"
2="me"
3="kill"
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|