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
cromaine
Beginner


Joined: 27 Feb 2010
Posts: 15

PostPosted: Sat Apr 03, 2010 9:37 pm   

Multiline Capture
 
CMUD 2.37. My first time to try a multistate trigger. I'm just trying to capture tells. A tell looks like this:

Joe calls to Brigands: "Hello there".

It always ends in a period, so that is what I am using to tell whether the tell is one line or more than one line.

My trigger pattern is: %x calls to Brigands: "(*)

The trigger pattern works fine.

Here's what the script for my trigger looks like:
#CAP BrigandCalls
#GAG
#IF (%ends("%1",".")) {#STATE BrigandCall 0} {#STATE BrigandCall 1}

Then, the #COND, which triggers on (*), looks like this:
#IF (!%null("%1")
{IF (%ends("%1",".")))
{#CAP BrigandCalls
#GAG
#STATE BrigandCall 0}
{#CAP BrigandCalls
#GAG
#STATE BrigandCall 1}
{STATE BrigandCall 0}


What happens is that when I get a tell, everything from then on gets captured and sent to the BrigandCalls window. So it seems as though the state variable never gets reset to 0. What am I doing wrong?
Thanks.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sat Apr 03, 2010 11:06 pm   
 
Remove the quotation marks from around %1, throughout your script. Also, in one line you have IF instead of #IF, and in another line, STATE instead of #STATE.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Sun Apr 04, 2010 7:05 am   
 
Wouldn't the problem be that the trigger triggers off (*), and that means it doesn't fire when it receives a null line?
Hence, it does not reset the state of the trigger. A better trigger would be:

#COND {(!%null(%line))} {#CAP BrigandCalls;#GAG;#if (%ends(%line,".")) {#state 0}} "" {LoopExp|Param=99}
Reply with quote
cromaine
Beginner


Joined: 27 Feb 2010
Posts: 15

PostPosted: Sun Apr 04, 2010 4:46 pm   
 
Thanks. Removing the quotation marks did the trick. I haven't tried the other way of writing the condition, but it looks like it might be more efficient.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Apr 04, 2010 8:24 pm   
 
Pretty sure * fires off of an empty line.
_________________
EDIT: I didn't like my old signature
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