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
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Sun Feb 08, 2004 3:47 pm   

trigger problem- displaying or gagging
 
Hi,

I want to capture a certain channel. The channel is an INFO channel

which always starts

INFO: message here

I want to capture when my friends either level or die etc but gag the info if it doesnt have my friend name in it.

The problem is that the level messages can be different for each person as they are all in different clans

e.g

INFO: Friendone raised a levels!
INFO: The light shines bright as friendtwo levels!

Ive played around with different methods first one was

#var friendinfo - contains the friends names i want to match

#trig {INFO~:%s(*)} {
infofriendtrue=0
infostringlist=%subchar( "%1", "!.?,:()[]<>", "")
infostringlist=%replace( @infostringlist, " ", "|")
#forall @infostringlist {
#if (%ismember( %i, @friendinfo)) {
infofriendtrue=1
}
}
#if (@infofriendtrue=1) {
#cap talk_info
} {
#gag
}
}


this just seemed an over kill and thought there must be a simpler way
plus it only seemed to work when i test echoed the messages not when it came up on the mud.didnt gag or capture then.

so then i went for the two triggers

#trig {INFO~:%s(*)} {#gag}

and

#trig {INFO~:*({@friendinfo})}

but the problem is if for example i have a name like Lan in the friendinfo list and the pattern

INFO: Clans tremble in fear etc etc

it matches the Clans in the word. Is there a way to prevent this? Im sure there is but i cant seem to come up with it


Is it possible to have it in one trigger?

thanks
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Feb 08, 2004 6:01 pm   
 
Two triggers seems like the better choice. The problem is to limit the string-list match in the #CAPTURE trigger to full words. This is fairly simple to achieve since it merely requires specifying that there be a space immediately before the string-list match, and either a space or a punctuation mark immediately following it. The %p wildcard matches punctuation including spaces.
#TR {INFO:* ({@friendinfo})%p} {#CAP talk_info}
Reply with quote
mortie
Wanderer


Joined: 26 Sep 2002
Posts: 73
Location: United Kingdom

PostPosted: Sun Feb 08, 2004 6:43 pm   
 
Thanks for the reply

works great now
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