Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
njkc07
Beginner


Joined: 09 May 2008
Posts: 15

PostPosted: Sat Mar 14, 2009 12:45 am   

Multistate Triggers, little buggers
 
Since I am not an experienced cmud user and have next to never used them I have failed utterly with my attempt at making one. Here goes...

I trigger off a certain pattern specifically an affliction message. There are two things that COULD happen when I receive this message.

A: I receive a prompt right after it
B: I get a "connect's to head" mesage

Now it can only be one or the other. I was on Aetolia's forums and noticed that some had said multistate triggers could handle this perfectly. So I attempted based on what I saw as example on the forums.

First attempt was...

Code:
#TRIG {^The massive trauma to your head has damaged your skull and brain considerably.$} {}
#COND {*} {}
#COND {^(%w) connects to the head!$} {#IF (@salvebal = 1) {apply restoration to head}} {reparse}
#COND {^H:} {say nice illusion;laugh} {reparse} {prompt|nocr}


So I have a friend give me the illusion and nothing happens, it gets hung up on the connects to the head part. So I reverse the connects message and the prompt message. The friend illusions me and wonderful it worked! Yay I am so glad. Then I have them give me the actual damage where they connect and bam it fires off nice illusion and then laughs which I didn't want it to do and doesn't heal my poor bruised head.

So then I tried...

Code:
#TRIG {^The massive trauma to your head has damaged your skull and brain considerably.$} {}
#COND {^H:} {say nice illusion;laugh} {within|param=1} {prompt|nocr}
#COND {^(%w) connects to the head!$} {#IF (@salvebal = 1) {apply restoration to head}} {Within|Param=1}


This to my disbelief had the same results as the one above it. So basically I am trying to use a multistate trigger to check the line following the affliction line. If it is a prompt then ultimate fail for them trying to trick me. If the next line is a connect then i need to put some salve on my quickly balding and lumpy head from all those hits.

Any help is appreciated. I realize I may have worded all of this wrong. So if it is confusing I will try to explain it a bit better.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Mar 14, 2009 3:54 am   
 
Actually, this code works fine for me. It's not the recommended way to use multistate triggers (generally they're supposed to be used only for sequential matches rather than this sort of branching) but it works. The only change I had to make was to correct the line #COND {^H:} {say nice illusion;laugh} {reparse} {prompt|nocr}, which should read #COND {^H:} {say nice illusion;laugh} {reparse|prompt|nocr}.

You should probably read this help file about the different kinds of multistate triggers and how they work.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
njkc07
Beginner


Joined: 09 May 2008
Posts: 15

PostPosted: Sat Mar 14, 2009 5:23 am   
 
ok then could you direct me a more effective way of doing it? Sorry not much knowledge on these things. I know enough to automate bare minimum.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Mar 16, 2009 4:42 pm   
 
The method I would probably use for this situation is have a simple trigger "The massive trauma", etc., which enables a class. Inside that class would be two triggers, one for a prompt, one for "connects to the head". Each of those triggers would disable the class. The class should be set to 'disable class when connecting'
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Mar 16, 2009 6:36 pm   
 
And if you were really going all-out, you'd have your prompt trigger raising an event (I use OnPrompt). You then stick an event handler in that class as well, that disables the class and does whatever you want to do if you get an illusion. If the triggers fire, the class is disabled - when the event is raised, the event handler is already disabled and won't do anything. If none of the triggers have fired, the event handler will still be active and will make sure you class is deactivated properly, as well as taunting your opponent or whatever.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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