Trigger Help

Posted by Victory on Thu 11 Apr 2002 12:56 AM — 11 posts, 31,842 views.

USA #0
I need help setting up a trigger, but my problem is the wildcards. heres an example:

Players near you:
Victory Entrance to Mud School
*Baron Victory* Entrance to Mud School

i need it to display the entire "*Baron Victory* Entrance to Mud School" with the "*" in it. i only need this for a spell called farsight. any ideas?
Vic
Australia Forum Administrator #1
Regular expressions will come to your rescue here. :)

There is a file supplied with MUSHclient that describes them, however it can be a bit daunting. The problem, of course, is that an asterisk is a wildcard. In a regular expression you can "escape" it. To match the line you gave, do this:


Match on: ^\*Baron Victory\* Entrance to Mud School$
Regular expression: checked


The "^" means "start of line", the "$" means "end of line", and the "\*" means "literally an asterisk".
USA #2
how would i make it say it in group talk (Gtell) and say the entire thing. Also the baron Victory and the location would have to be able to be diffrent though.. Theres more rooms than that one.. any way to change it there too?
Vic
Australia Forum Administrator #3
Ah OK, I didn't know exactly what you were trying to do.

To capture the name, you put it in brackets, then you can send the wildcard back. Like this:


Match on: ^\*(.+)\* (.+)$
Send: gtell I am at location %1
Regular expression: checked


In this case "(.+)" means "one or more of anything" - put into a wildcard. As there are two of them the first is wildcard 1, and the second wildcard 2.

By sending %1 to the MUD you are sending back wildcard 1.
Australia Forum Administrator #4
If you literally want to gtell the entire thing, try this:

Send: gtell %0

%0 is the entire matching line.
USA #5
thanks. now to warn my groups that it'll say that on decoys too :-p
Vic
USA #6
is there a way to make it not send anything where they yell, or are in the room?
example:
*Baron Victory* yells 'Hey, what level are you?'
gtell '*Baron Victory* yells 'Hey, what level are you?''
you tell the group ' *Baron Victory* yells 'Hey, what level are you?''

and

*Baron Victory* is here
gtell *Baron Victory* is here
you tell the group '*Baron Victory* is here'

is there a way to stop the gtells in those strings?
Vic
Australia Forum Administrator #7
I thought your trigger might be a bit pervasive. :)

The simple way is to make three triggers, and sequence them (use the sequence field).

eg. something like this:



Trigger 1

Match on: ^\*(.+)\* yells (.*)$
Send: (nothing)
Regular expression: checked
Sequence: 80

Trigger 2

Match on: ^\*(.+)\* is here$
Send: (nothing)
Regular expression: checked
Sequence: 90

Trigger 3

Match on: ^\*(.+)\* (.+)$
Send: gtell %0
Regular expression: checked
Sequence: 100


The first two triggers (done first because of the sequence) "filter out" the yells and "is here" (by sending nothing). Then if the trigger doesn't match those two it reaches the 3rd one, which does the gtell.
USA #8
thanks once again. If i come across anything else, i'll leave you a note.
-Vic
USA #9
boy, didn't take me long huh?
those set ups didn't seem to work, the
Match on: ^\*(.+)\* (.+)$
Send: gtell %0
Regular expression: checked
Sequence: 100

is still the dominate, overtaking the others you gave me. In my trigger list i've got about 30 triggers, don't think that'd have anything to do with it, but its some information. Is there any way to make it trigger on the "Players near you:" or use some short cut to turn the trigger on and off without going to the menu all the time? if worse comes to worse, i'll have to try and make a script, but then i'll have to learn to code first....
vic
USA #10
nevermind, i found it. forgot to enable the trigger..
oops
Vic