Posted by
| Nick Gammon
Australia (22,991 posts) bio
Forum Administrator |
Message
| Probably the easiest way to do that is to make two triggers (a multi-line trigger can't omit from output), like this:
<triggers>
<trigger
enabled="y"
lines_to_match="1"
match="There are currently * player killers online:"
omit_from_output="y"
send_to="12"
sequence="100"
>
<send>EnableTrigger ("capturePKs", true)</send>
</trigger>
<trigger
lines_to_match="1"
match="*"
name="capturePKs"
omit_from_output="y"
send_to="12"
sequence="100"
>
<send>
local names = {}
-- build names into table
for w in string.gmatch ("%1", "%a+") do
table.insert (names, w)
end -- for
require "addxml"
if #names > 0 then
addxml.trigger {
enabled = 'y',
regexp = 'y',
['repeat'] = 'y',
custom_colour = '17',
sequence = '100',
other_text_colour = 'red',
match = '\\\\b(' .. table.concat (names, '|') .. ')\\\\b',
name = 'pkillers',
}
else
DeleteTrigger ('pkillers')
end -- if
EnableTrigger ("capturePKs", false) -- disable ourselves
</send>
</trigger>
</triggers>
The first trigger, which is always active, matches the line about "There are currently * player killers online:". This enables the second trigger. The second trigger, which matches anything, capture the player names and then disables itself, ready for next time.
Both triggers omit from output, so you don't see the matching lines. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|