|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Sun Dec 31, 2006 5:02 pm
Disabling & Enabling Triggers with Other Triggers |
Is it possible to disable a trigger or enable a trigger with another trigger?
Basically, I want to set up a series of triggers that will always cast a spell when necessary.
I.E. When I log on, I "cast light" this casts the spell light. When the spell runs out, it sends me the text: "Your cast light spell has ended." (actually its something a bit more interesting and descriptive, but I forget the words right now).
When I encounter the text that says it's ended, I want to cast another light spell. However, this spell can fail. If I encounter the fail text, I want to wait 1 seconds, then recast it. The fail test however, is generic, so I can't have it enabled all the time, only when I am casting a new light.
So, basically: When my light ends, I want to enable a trigger that will recast light after a 1 second delay if it fails. When the light successfully casts, I want to disable the recast trigger.
Is that possible? Is this a good solution or is there another that would be better? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Dec 31, 2006 5:15 pm |
#T- and #T+ work on triggers (easier to use if your triggers have ID's) but for something like this I would use multistate triggers. This is untested but should work
#TR "cast_onLogin" {^You log in} {cast light} //This is the trigger to cast it on login
#TR "cast_light" {^You cast light spell has ended.} {cast light} //This is another trigger to recast when it ends
#COND {^OMG WTF we failed message!} {} {within|param=5} //This is a condition its active after the cast light end and will only fire within 5 lines of it
#COND {} {cast light} {wait|param=1000} //This is a wait condition it will wait for 1 second then cast light after the omg we failed message |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Dec 31, 2006 5:23 pm |
I was under the impression that when a Within trigger state failed to match, it moved onto the next state without executing anything. Having tested it, though, it seems that if it fails to match within that number of lines, it resets the trigger to the first state. Do Loop Lines and things work this too?
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Dec 31, 2006 5:28 pm |
yes, if a state fails to match within the parameter then the trigger is reset to state 0. Looplines is the same way if looplines|param=30 is passes and the trigger fails to match on the 15th pass it gets reset to state 0.
|
|
|
|
|
|