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


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: 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?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Fang Xianfu
GURU


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

PostPosted: 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?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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.
_________________
Zmud Support Library
Zmud Knowledge Base
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