I currently have a variable (wf_people), of the form "foo|bar|bah|baz"
I then tried to make a trigger "^.*(?:@wfpeople).*$"
If I did the sustituion by hand (i.e. put "foo|bar|bah|baz" in the trigger) the trigger fires correctly. If I put it with @wf_people, however, it does not. I have "Enabled', "Ignore case", "Keep Evaluating", "Regular Expression", and "Expand variables" checked.
Am I just missing something stupid, or is it trying to treat the "|" in the variable as literals, or something else entirely?
The problem here is that MUSHclient tries to be smart, and assumes that if you have a special character (eg. "(") inside your variable, that it needs to be "escaped" by putting a \ in front of it, when inserting it into a regular expression.
The only real workaround here is to assemble the trigger by hand. That is, whenever you change the variable (eg. using an alias) reassemble the trigger.
There is a recent example of doing exactly that, as I had the same problem recently making a "gag" plugin. See how it was done here:
Sub MakeTrigger
'
' remember gag list in variable for plugin state save
'
SetVariable "gags", ArrayExport ("gags", "|")
'
' enable/disable trigger depending on whether we have gagged players
'
EnableTrigger "gags", ArraySize ("gags") <> 0
'
' change the trigger match text - replace !! by the gag list
'
If SetTriggerOption ("gags", "match", _
Replace (GetVariable ("regexp"), "!!", _
ArrayExportKeys ("gags", "|"))) = eBadRegularExpression Then
ColourNote "white", "red", _
"Could not set trigger - check regular expression syntax"
ColourNote "white", "red", "Regular expression is currently: " _
& GetVariable ("regexp")
End If
End Sub
This code keeps the "original" regular expression in a variable, and replaces the !! part of it with the variable contents.
Since I was already generating the pipe-delimited list from a perlscript, it was relatively trivial to add the SetTriggerOption line :)
Have you considered, potentially, either:
a) making variables-in-regular-expression perl like (thereby requiring something like perls qw() function)...admittedly, this would break lots of things
b) adding something that's more-or-less the _opposite_ of qw(). Thereby informing any regexps that the variable is in to _not_ escape metachars.
Either of those would be nice, and would make the trigger much more readable :)