Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Dorrin
Novice


Joined: 08 Aug 2002
Posts: 41

PostPosted: Thu Aug 08, 2002 9:34 pm   

Yet another Trigger question.
 
The trigger I'm having problems with is:

^%1 tells the group '%w %3'.

the pattern is:
#if (%2 = link) {link %1}
#if (%2 = rel) {rel}
#if (%2 = c) {
gra
c %3 %1
tie all
}
#if (%2 = d)and(%1 = @trusted) {%3}
#if (%2 = untie) {untie %3 %1}
#if (%2 = teach) {#10 c %3 %1}
#if (%2 = sleep) {nap}
#if (%2 = wake) {sta}
#cap chat
#gag

@trusted is a list of people who have access to "bot" me, which is legal on the MUD I use this character.

The problem I'm having is that I can't figure out how to get the %2 to be limited to one word. I've tried (%w) and I've tried putting { }, " ", and ( ) around the words in the command section I'm checking against, but all I end up doing is getting spammed off the mud whenever a multi-word pattern tries to match against it.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Aug 08, 2002 9:44 pm   
 
You should not use %1..%n in your trigger patterns. You use wildcard like %w, %d and * and you surround the wildcard in parenthesis if you want whatever is matched by it to be saved and stored in %1..%n. Your pattern should then be:
^(%w) tells the group '(%w) (*)'.

Next, you need to make a small change in what your trigger does. The line that needs to be changed is:
#IF (%2 = d)and(%1 = @trusted) {%3}

The problem is that you must surround the complete expression to be tested in an if check in parenthesis and that you can compare a string, like %1, with a stringlist, you need to use the %ismember function. So your line now becomes:
#IF ((%2 = d) and (%ismember(%1, @trusted))) {%3}

Kjata
Reply with quote
Dorrin
Novice


Joined: 08 Aug 2002
Posts: 41

PostPosted: Tue Aug 13, 2002 2:15 am   
 
Well, the suggestion sorta worked. I ended up needing to break it into two separate triggers, one with the pattern of ^(%w) tells the group (%w)'.$ for the single word commands and ^(%w) tells the group '(%w) (*)'.$ for the multiple word ones.

The problem I'm having now is whenever a group member starts a grouptell with the word not, it causes the multi-word trigger to fire. Is there anyway to get it to ignore anything that doesn't start with d, c, untie, or teach?
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Tue Aug 13, 2002 2:46 am   
 
ooo, I haven't played a WoT mud in a while, forgot how fun they could be. Anyways, I believe you can still do this with 1 trigger:

#trigger {^(%w) tells the group '(*)'.} {#cap chat;#gag;#if (%numwords( %2)=1) {#if (%2=link) {link %1};#if (%2=rel) {rel};#if (%2=sleep) {nap};#if (%2=wake) {sta}} {#if (%word( %2, 1)=c) {gra;#exec %2 %1;tie all};#if ((%word( %2, 1)=d) and (%ismember( %1, @trusted))) {%right( %2, 2)};#if (%word( %2, 1)=untie) {#exec %2 %1};#if (%word( %2, 1)=teach) {#10 {c %right( %2, 6) %1}}}}

That should just cut-n-paste in the command line, if not, here's the expanded version of the value of the trigger:



#cap chat
#gag
#if (%numwords( %2)=1) {
#if (%2=link) {link %1}
#if (%2=rel) {rel}
#if (%2=sleep) {nap}
#if (%2=wake) {sta}
} {
#if (%word( %2, 1)=c) {
gra
#exec %2 %1
tie all
}
#if ((%word( %2, 1)=d) and (%ismember( %1, @trusted))) {%right( %2, 2)}
#if (%word( %2, 1)=untie) {#exec %2 %1}
#if (%word( %2, 1)=teach) {#10 {c %right( %2, 6) %1}}
}



Iljhar
Reply with quote
Dorrin
Novice


Joined: 08 Aug 2002
Posts: 41

PostPosted: Tue Aug 13, 2002 3:12 am   
 
Hey thanks! Yeah, it's for a WoT mud called Broken Seals.

The new trigger works great except for that same problem. Anything that is said in grouptalk that starts with the word "not" causes the trigger to go through the entire command set.

Know of any way around that?
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Tue Aug 13, 2002 3:23 am   
 
I used to play on Broken Seals! Wow, flash back. Anyways, update for the "not" part:

#trigger {^(%w) tells the group '(*)'.} {#cap chat;#gag;#if (%word( %2, 1)!="not") {#if (%numwords( %2)=1) {#if (%2=link) {link %1};#if (%2=rel) {rel};#if (%2=sleep) {nap};#if (%2=wake) {sta}} {#if (%word( %2, 1)=c) {gra;#exec %2 %1;tie all};#if ((%word( %2, 1)=d) and (%ismember( %1, @trusted))) {%right( %2, 2)};#if (%word( %2, 1)=untie) {#exec %2 %1};#if (%word( %2, 1)=teach) {#10 {c %right( %2, 6) %1}}}}}

Or:



#CAPTURE chat
#GAG
#IF (%word( %2, 1)!="not") {#IF (%numwords( %2)=1) {
#IF (%2=link) {link %1}
#IF (%2=rel) {rel}
#IF (%2=sleep) {nap}
#IF (%2=wake) {sta}
} {
#IF (%word( %2, 1)=c) {
gra
#EXECUTE %2 %1
tie all
}
#IF ((%word( %2, 1)=d) and (%ismember( %1, @trusted))) {%right( %2, 2)}
#IF (%word( %2, 1)=untie) {#EXECUTE %2 %1}
#IF (%word( %2, 1)=teach) {#10 {c %right( %2, 6) %1}}
}}


If you don't want it to be captured, just put the #cap and #gag after the first if check.

Iljhar
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net