|
spoonfoy Newbie
Joined: 10 Oct 2016 Posts: 5 Location: NC, USA
|
Posted: Mon Oct 10, 2016 10:08 pm
Amateur coder seeking help understanding a circumstantial trigger |
ive recently gotten back into mudding after a ~10 year hiatus, and am trying to rewrite my old scripts and triggers and such. any help with helping me to understand this problem is greatly appreciated.
im trying to write a trigger that will fire against certain mobs, but not others. for instance:
"You fail to stun the knight."
i would like the trigger to fire and send "stun" to the mud to try and stun again.
however, there are zombie mobs that cant be stunned, and trying to causes an infinite loop of disappointment. so, for:
"You fail to stun the corpse of the knight."
i do NOT want the trigger to fire. every "zombie" mob in the game uses the identifier "the corpse of".
the trigger im currently using, and cannot figure out why it doesnt work, is this:
^You fail to stun*{^the corpse of}*.$
the commands of the trigger are
#CO 140
stun
the trigger works fine on non-zombie mobs, it tries to restun and continues to do so until a successful stun. however, it still fires when fighting zombies. can anyone explain where i went wrong and how to fix it please? thank you very much for any help in advance. |
|
|
|
spoonfoy Newbie
Joined: 10 Oct 2016 Posts: 5 Location: NC, USA
|
Posted: Mon Oct 10, 2016 10:10 pm |
oh, also, im not nearly up to snuff as i used to be, so if you could ELI5 just to be on the safe side, itd be greatly appreciated. :)
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Tue Oct 11, 2016 12:18 am |
The exclusion range would be [^the corpse of] i believe, but you have so many * wildcards i'm not sure it would matter.
Easier to test the results for a false positive than to exclude it from firing in the first place.
Besides, I assume you want it colored either way.
#TR {^You fail to stun} {#CO 140;#IF (!%match(%line, "the corpse of")) {stun}} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
spoonfoy Newbie
Joined: 10 Oct 2016 Posts: 5 Location: NC, USA
|
Posted: Tue Oct 11, 2016 2:07 am |
ah. so its brackets instead of braces to exclude a pattern. help page listed braces, so i rolled with it. thank you. =)
will run with your suggestion, and see if i can muddle out how to spruce up my future attempts. <3 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Tue Oct 11, 2016 2:22 pm |
Oh, so it does... I assume by making it an anonymous variable.
I was thinking of the range of characters which is the square brackets.
The carrot inside the brackets functions like like an exclamation point in expressions/equations. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Oct 12, 2016 12:53 am |
The only ways I can think of for doing this is with a regex or in script.
#REGEX {^You fail to stun (?!the corpse of)} {#CO 140;stun}
or
#TRIGGER {^You fail to stun (*)$} {#IF (!%begins(%1, "the corpse of")) {#CO 140;stun}} |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
spoonfoy Newbie
Joined: 10 Oct 2016 Posts: 5 Location: NC, USA
|
Posted: Thu Oct 13, 2016 6:29 am |
this is all great stuff. thanks much for showin' me multiple ways to play with this concept and clarifying braces/brackets. =)
|
|
|
|
|
|