|
mortie Wanderer
Joined: 26 Sep 2002 Posts: 73 Location: United Kingdom
|
Posted: 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 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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} |
|
|
|
mortie Wanderer
Joined: 26 Sep 2002 Posts: 73 Location: United Kingdom
|
Posted: Sun Feb 08, 2004 6:43 pm |
Thanks for the reply
works great now |
|
|
|
|
|