Chat redirect match problem

Posted by Boen310 on Fri 17 Aug 2018 03:22 PM — 5 posts, 20,984 views.

#0
Hello,
I currently use a chat redirect and trying to apply it to a new mud. I am unable to match the pattern to pick up the chat I want to redirect. The chat patterns are :

[NewbiE] Roen: 'test'
[OOC] Roen: -- 'test'

I am trying to match on [NewbiE] and [OOC]

<trigger
enabled="y"
match="%OOC% + '.*'$"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

<trigger
enabled="y"
match="%NewbiE% + '.*'$"
regexp="y"
script="redirect"
sequence="100"
>
</trigger>

Any help be greatly appreciated.
Australia Forum Administrator #1
This has no way of matching on what you are trying to:


 match="%OOC% + '.*'$"


If you are trying to match square brackets, you need to use square brackets, however "escape" them with a backslash because they have a special meaning otherwise. More like this:


 match="^\[OOC\].*"



More simply, don't use regular expressions and just use a normal wildcard:


 match="[OOC]*"





Template:regexp
Regular expressions
  • Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
  • Also see how Lua string matching patterns work, as documented on the Lua string.find page.
Amended on Sat 18 Aug 2018 07:21 AM by Nick Gammon
#2
Thank you seems to work but get this message now when loading it.

Can't open chat world file: C:\Program Files (x86)\MUSHclient\worlds\DB Chat.mcl
Reinstalled plugin Chat_Redirector (cb84a526b476f69f403517da)

and this is what chat_world

chat_world = "DB Chat"
local first_time = true

and my Chat window is saved as DB Chat.mcl
#3
Got it somehow a previous saved .MCL had the same name. Maybe created when I was trying to set this up.

Also using this match- match="[OOC]*" was redirecting all to chat window.

When I used match="^\[OOC\].*" it worked good.
Thank you
Amended on Sat 18 Aug 2018 10:43 AM by Boen310
Australia Forum Administrator #4
These days it is easier to use the miniwindows version of the chat plugin. I think the latest version is here:

http://www.gammon.com.au/forum/?id=10728

As for the match, the second suggestion I made was not a regular expression, so you need to turn that off:


 regexp="n"