|
SRPrice Beginner
Joined: 19 Jul 2007 Posts: 18
|
Posted: Fri Dec 28, 2007 8:49 pm
Capture or Trigger off Part of a string. |
I have what I thought would be a simple idea, but I can't seem to figure out how to make it work.
Mud outputs:
(Injured) (Hostile) An angry troll searches for someone to kill.
(Injured) (Hostile) An angry troll is here, fighting PlayerX!
(Injured) (Hostile) An angry troll is here, fighting YOU!
Line 1 is the normal description of the mob. (however it has been injured by either you or another player, thus the injured flag)
Line 2 is the descripton when mob is fighting another player.
Line 3 is the description when mob is fighting you.
I wanted a trigger that would #ECHO various alerts depending on which of these 3 outputs occur.
I thought that a simple trigger on ~(Injured~) (*) would be ok, and then use #IF to set off the alerts, but the outputs between line 1 and lines 2/3 are so different, I don't know if I can do that, unless I can just capture and evaluate "part" of the output.
Also with various mobs, the mobname/descriptions can vary widely. If I could get it down to 1 alert for Lines 1/2, and a seperate for Line 3, that would be ok. I just can't figure out how to get it to trigger on one w/o triggering the others or not triggering at all.
The only common factor between all 3 is the (Injured) part.
Lines 2 and 3 both have "is here, fighting (%w)!"
Is there a way to trigger off the (Injured) flag, and then capture the "is here, fighting (%w)." parts, and then run that through some #IF (%1 = "is here, fighting YOU!") or #IF (%1 = "YOU") {#ECHO Your mob!} {#ECHO Not your mob?}
Basically, if lines 1 or 2 are displayed, I want the "Not your mob?" to echo, and if line 3 displays, then I want "Your Mob!" to display.
Any tips or suggestions would be greatly appreciated. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Dec 28, 2007 9:03 pm |
You can either use two separate triggers (one for mobs in combat, one for mobs not) or a single regex. I'd recommend the former.
#trig {~(Injured~) [%w ] searches for someone to kill.} {#say whatever}
#trig {~(Injured~) [%w ] is here, fighting (%w)!} {#if (%1="YOU") {#say fighting you} {#say fighting someone else}} |
|
|
|
SRPrice Beginner
Joined: 19 Jul 2007 Posts: 18
|
Posted: Fri Dec 28, 2007 11:27 pm |
Actually i figured it out.. I found a space in my trig where there was not one in the mud out put.
^{~(Injured~)*|~(Injured~)* is here~, fighting (%w)}
#IF (%1 <> "YOU" or %1 = "") {#SAY Not your mob?} {#SAY Your Mob!} |
|
|
|
|
|
|
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
|
|