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
spoonfoy
Newbie


Joined: 10 Oct 2016
Posts: 5
Location: NC, USA

PostPosted: 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.
Reply with quote
spoonfoy
Newbie


Joined: 10 Oct 2016
Posts: 5
Location: NC, USA

PostPosted: 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. :)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3513
Location: Pensacola, FL, USA

PostPosted: 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}}
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
spoonfoy
Newbie


Joined: 10 Oct 2016
Posts: 5
Location: NC, USA

PostPosted: 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
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3513
Location: Pensacola, FL, USA

PostPosted: 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.
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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
Reply with quote
spoonfoy
Newbie


Joined: 10 Oct 2016
Posts: 5
Location: NC, USA

PostPosted: 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. =)
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