|
quigbrew Novice
Joined: 04 Jun 2002 Posts: 31
|
Posted: Sat Jun 26, 2004 5:48 am
Resetting States |
I think this is an easy question. I'm trying to figure out how to make a trigger that resets the state of the current trigger to the 0 state without continuing to the next state.
Example:
** Illusion **
You shuffle your feet noisily, suddenly bored.
You're unable to focus your mind.
** Illusion **
Both lines are illusions and both are triggers in my system. I'll just take the, "You shuffle, etc" example and copy/paste the trigger to make this easier.
Trigger:
^You shuffle your feet noisily, suddenly bored.$
Values:
State 0:
#if (%pos( @illusion_msg, %line2 | %line3)) {#state 0}
State 1: (condition set to within 1)
#if (%pos( @illusion_msg, %line)) {} {heal}
The @illusion_msg value is, ** Illusion **
So, basically the trigger checks the preceding two lines to see if ** Illusion ** is present, if it is present, I want it to reset the trigger to the 0 state and not continue to the first state. If ** Illusion ** is not present I want it to continue to the first state where it will check the line after the trigger line for the ** Illusion ** message, where it will do nothing if found, or heal accordingly if the illusion message is not there. The #state 0 doesn't seem to be stopping and resetting the trigger, maybe I should use #abort 1 and #state 0?
The ** Illusion ** message varies in it's location, sometimes it's above the illusion, sometimes below, sometimes both, and sometimes neither, so I just want the trigger to cover all basis.
So, all I need to know is how to make the 0 state reset itself without going onto the 1 state if certain criteria are met. Unless, someone sees some errors in my thought process or knows a better way to do it. I'm open to suggestions!
I don't really understand how to put triggers in #trigger form and enter them using the command line, so I apologize for presenting it in my dumbified way. :P
Thanks in advance! |
|
|
|
quigbrew Novice
Joined: 04 Jun 2002 Posts: 31
|
Posted: Sat Jun 26, 2004 10:41 am |
I made an error in my post, state 1's condition is actually set to within 2, not within 1. Also state 1 is set to trigger on the prompt and not newline. Not sure if that makes a difference or not, but I thought you guru's should know.
Thanks again |
|
|
|
geniusclown Magician
Joined: 23 Apr 2003 Posts: 358 Location: USA
|
Posted: Sat Jun 26, 2004 3:26 pm |
I believe your problem is the attempted use of a list in the %pos function. In all my attempts, I've never been able to get that working. My suggestion:
quote:
#TR {^You shuffle your feet noisily, suddenly bored.$} {
#IF (%pos(@illusion_msg, %line1) or %pos(@illusion_msg, %line2)) {#STATE 0}}
#COND {prompt} {#IF (%pos( @illusion_msg, %line)) {} {heal}} {within|param=2}
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Jun 26, 2004 4:14 pm |
Since you are finding it difficult to prevent the state from advancing, do the obvious and give it a state to advance to.
Trigger:
^You shuffle your feet noisily, suddenly bored.$
Values:
State 0:
#if (%pos( @illusion_msg, %line2 | %line3)) {#STATE 1} {#STATE 2}
State 1: Pattern blank, Type Skip Lines, Param 0
#STATE 0
State 2: (condition set to within 2)
#if (%pos( @illusion_msg, %line)) {} {heal} |
|
|
|
quigbrew Novice
Joined: 04 Jun 2002 Posts: 31
|
Posted: Sat Jun 26, 2004 10:36 pm |
Okay, here's what I've tried and neither seems to work.
Geniusclown's idea:
quote: #TRIGGER {^You shuffle your feet noisily, suddenly bored.$} {#IF (%pos( "** Illusion **", %line2) or %pos( "** Illusion **", %line3)) {#STATE 0}} "Triggers|Fighting|Need_Something|Need_Herb|GS_Afflictions"
#COND {*} {#if (%pos( "** Illusion **", %line)) {} {#var impatience 1;heal}} {within|param=2|nocr|prompt}
Lightbulb's idea:
quote: #TRIGGER {^You shuffle your feet noisily, suddenly bored.$} {#IF (%pos( "** Illusion **", %line2) or %pos( "** Illusion **", %line3)) {#STATE 1} {#state 2}} "Triggers|Fighting|Need_Something|Need_Herb|GS_Afflictions"
#COND {} {#state 0} {skip}
#COND {*} {#if (%pos( "** Illusion **", %line)) {} {#var impatience 1;heal}} {within|param=2|nocr|prompt}
I exported my triggers and just copied and pasted what the text file says, so hopefully this will help you more then me trying to explain what I did. If someone can get this to work, I would be forever grateful! Thanks again! |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Jun 27, 2004 3:08 am |
This really isn't very well suited to a multistate trigger. Use a multiline trigger.
#TR {(*)$(*)$You shuffle your feet noisily, suddenly bored.$(*)$(*)} {#IF !(%pos( Illusion, "%1") OR %pos( Illusion, "%2") OR %pos( Illusion, "%3") OR %pos(Illusion, "%4")) {heal}} |
|
|
|
quigbrew Novice
Joined: 04 Jun 2002 Posts: 31
|
Posted: Mon Jun 28, 2004 1:57 am |
Lightbulb's way works, however because there's literally hundreds of triggers I need to do this to, and it would slow down my system way too much. I tried doing it the following way using %line2 and %line3 instead of (*)$(*)$ before the actual trigger and it's not matching the preceding lines appropriately.
quote: #TRIGGER {^You shuffle your feet noisily, suddenly bored.$(*)$(*)} {#IF !(%pos( Illusion, %line2) OR %pos( Illusion, %line3) OR %pos( Illusion, "%1") OR %pos( Illusion, "%2")) {#var impatience 1;heal}} "Triggers|Fighting|Need_Something|Need_Herb|GS_Afflictions"
Is there something wrong with my syntax? I don't understand why %line doesn't work.
Thanks again everyone! |
|
|
|
quigbrew Novice
Joined: 04 Jun 2002 Posts: 31
|
Posted: Tue Jun 29, 2004 3:11 pm |
okay, I think I know what was happening in my last attempt. The %line2 and %line3 weren't being looked at until the end of the trigger, which was two lines past the affliction message. So, it was essentially only looking up far enough to see what was already looked at (hope that makes sense.)
Since everything I've thought of doesn't seem to work and lightbulb's idea is too hard on my system, does anyone else have any other ideas of how I could trigger this?
Thanks |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Jun 29, 2004 6:04 pm |
Don't know if this will be any better but it also appears to work. I hope you're actually trying a large number of patterns and aren't rejecting solutions because of untested assumptions.
#TR {Illusion} {#VAR Illusion 1}
#COND {} {#VAR Illusion 0} {LoopLines|Param=2}
#TR {You shuffle your feet noisily, suddenly bored.} {#IF (@Illusion) {#VAR Shuffle 0} {#VAR Shuffle 1}}
#COND {Illusion} {#VAR Shuffle 0} {Looplines|Param=2}
#COND {} {#IF (@Shuffle) {heal}} {Wait|Param=1} |
|
|
|
quigbrew Novice
Joined: 04 Jun 2002 Posts: 31
|
Posted: Wed Jun 30, 2004 7:48 am |
Lightbulb! You're my hero!
I've added your suggestions to a fair amount of triggers and did a good amount of testing and so far, it's working great. Thanks for everything! |
|
|
|
|
|
|
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
|
|