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
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Tue Oct 05, 2010 2:14 am   

Multi state trigger help
 
Greetings.

I am attempting to do something which in my mind seems should be pretty simple. I want to keep track of how many times i succeed at doing something in a row. The tricky part comes from what I need to trigger on. Below is an example of mud output.


You finish practicing.
You think you would have succeeded.
You finish practicing.
You think you would have succeeded.
You finish practicing.
You think you would have succeeded.
You finish practicing.
You finish practicing.
You think you would have succeeded.

I want to count the succeeds, but only if the succeeds are in a row. Otherwise i want to reset the variable back to 0. In the example of that output, the varible would count to 3, but then it would see that i did not succeed on the 4th try and go back 0, then count to 1 again on the 5th try.

I hope I am being clear and someone can help me with this.
Thanks
Reply with quote
Tanuki
Novice


Joined: 06 Nov 2008
Posts: 38

PostPosted: Fri Jan 28, 2011 10:44 pm   
 
How about something like :

Untested
Code:

<trigger priority="5380" id="538">
  <pattern>You think you would have succeeded. $</pattern>
  <value>succeed = @succeed + 1; finish = 0
</trigger>

<trigger priority="5380" id="538">
  <pattern>You finish practicing. $</pattern>
  <value>Finish = @Finish + 1
If (Finish = 2) {@succeed = 0}</value>
</trigger>
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jan 29, 2011 6:17 pm   
 
You will want to use a multi-state trigger for this. State 0 will be the finish practicing line, State 1 will be a Within Lines type with a stringlist of the succeeded message and the finish practicing message. If State 1 is the latter message, then reset the var to zero otherwise #add 1 to it:

Code:
#trigger {^You finish practicing.$} {}
#condition {^({You think you would have succeeded|You finish practicing}).$} {
  #if (%1 = "You finish practicing") {Count = 0} {#add Count 1}
} {WithinLines|param=1}
_________________
EDIT: I didn't like my old signature
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