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
sav
Wanderer


Joined: 09 Jan 2006
Posts: 86

PostPosted: Mon Aug 17, 2009 9:22 pm   

Trigger on variable change
 
hi,
i have triggers which capture my hpbar. when i'm fighting, the health status of the monster is shown and when i'm not, there's no status.

R:3/83% GH:H
R:3/83% GH:H E: close

E: close is already captured into a variable and gagged.
i want to perform an action on the round that "E: something" appears on the hpbar. 'something' can also be other things as the monster's health changes so i can't just set an expression trigger for the variable.
is there any way to do this?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Aug 18, 2009 1:27 pm   
 
Do you want to do this only with a specific value of "something", or any "something"?
Reply with quote
sav
Wanderer


Joined: 09 Jan 2006
Posts: 86

PostPosted: Tue Aug 18, 2009 6:16 pm   
 
basically, i want to perform an action on the round when my hp goes from having no enemy status, to having an enemy status. and the 'something' for enemy status is not always the same. so i guess, any 'something'.
Reply with quote
dak
Beginner


Joined: 08 Aug 2009
Posts: 14

PostPosted: Wed Aug 19, 2009 1:46 am   
 
So, when capturing and gagging that variable:
Code:
if var == something
  perform an action on this round
end if


The above is pseudo code.
Reply with quote
sav
Wanderer


Joined: 09 Jan 2006
Posts: 86

PostPosted: Wed Aug 19, 2009 7:10 am   
 
no, with that code, it'll fire every time the variable is something.
i only want it to fire on the round that the hpbar changes from R:3/83% GH:H to R:3/83% GH:H E: something.
the 'something' can be anything from another word to a digit depending on what i'm fighting.
Reply with quote
dak
Beginner


Joined: 08 Aug 2009
Posts: 14

PostPosted: Wed Aug 19, 2009 8:00 am   
 
so have a variable keep track of what GH:H is, and when you fire to capture the variable, test to see if it changed.
Code:
prev_var = previous value of hpbarvar
if var == something AND hpbarvar != prev_var
  perform an action on this round
  prev_var = hpbarvar
end if
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Aug 19, 2009 8:46 pm   
 
I can think of a couple other ways to do it, too. One would be to have a trigger watching for "E:" in the prompt, which fires the action, enables a second trigger, and disables itself. The second trigger then watches for a prompt without "E:" in it, enables the first trigger, and disables itself.
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