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
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Wed May 16, 2007 6:20 am   

multistate trigger help-resetting triggers
 
I have a multistate trigger set up (with shorter patterns for ease)
pattern-blehuya1
id-restogoodtrig
script-none
trigger state 2 (withn state, set to 4 lines)
pattern-testline
script-#raise needheal
#set restogoodtrig 1 1

and an event called needheal as vollows

Code:
#t+ restogoodtrig
#t+ restonogood
#var curelight {15}
#var cureserious  {}
#var cure dire  {70}
#var heal  {110}
#var greater heal  {160}
#var restoration  {255}
#var minrestorelevel @maxhp-(@restoration/2)
#show minresto @minrestorelevel
#if (@hp<@minrestorelevel) {#show @hp;cast 'restoration'} {#show bleh @hp;#t- restogoodtrig;#t- restonogood}

So, the idea is that I raise the needheal event, it arms two triggers, a heal successfull trigger, and a heal not successfull trigger, then it calculates how much hp I have, and if I need cast a heal spell. Once it it casts the spell, the triggers are armed, and it looks for either the successfull string (blehuya1), or the unsucessfull string (heal didnt succeed). If a the successfull string is found, it raises the event again and the process keeps looping until my @hp>minrestorelevel at which time it should jump to the #show bleh, and turn off both triggers. for some reason, after the event is raised, the restogoodtrig is not firing. My question, (besides the obvious please help me part :) is how do I properly reset the trigggers? Ideally, when the event is initially raised, it should arm the two triggers, then cast the spell if needed. If the spell is successfull, the sucessfull trigger should fire, which will raise the event again. The event will keep raising until my hp>minresotrelevel, then it will disarm both triggers and the event will end. Currently, after I fire the second trigger state, i see a blue triangle next to it, indicating the first state fired, now its waiting for the second state to fire. This is why i've added the #set commands, but I don't think im using them correctly.
Any help would be appreciated. this is my first attempt at using events, and I also suck at setting up multistate triggers if you can't tell :)
Jed.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed May 16, 2007 12:33 pm   
 
#SET adjusts the fired status of a state. You need to use the #STATE command to adjust which state is currently active.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed May 16, 2007 1:03 pm   
 
You might want to avoid variables with spaces in the names, too.
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Wed May 16, 2007 4:11 pm   
 
soo, I would use a line like #state restogoodtrig 0 to completely reset it then, it looks like. Thanks vij. I completely missed the space there :P I don't use spaces so that mustabeen a brain fart. Thanks again
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed May 16, 2007 4:41 pm   
 
You don't need a #state 0 at the end of the trigger if there's nothing following it. Once the last state's script has finished (or been skipped if it has the within parameter or something) the trigger will reset itself.

#trig {I'm a very long line which has become so long that the MUD server has word} {}
#cond {wrapped me. Oh dear.} {script} {within|param=1}

would work, for example.
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