Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Wasperine
Newbie


Joined: 30 May 2006
Posts: 6
Location: Langley, BC, Canada

PostPosted: Fri Jun 09, 2006 6:39 am   

Triggers and Gauges
 
Alright, please bear with me...


I have a gauge for hp that I want to add a third color to. So far I have this:


Variables:
All required variables are accounted for



Trigger:


Pattern:
HP: &hp/&maxhp SP: &mana/&maxmana XP: &xp/&tnlxp

Value:
#MATH currentxp {%int( %replace( @currentxp, ",", ""))}
#MATH tnlxp {%int( %replace( @tnlxp, ",", ""))}
#MATH maxxp (@currentxp + @tnlxp)

Other Options:
Trigger on Trigger

Trigger On:
Prompt



Button:


Kind:
Gauge

Caption:
HP: @hp / @maxhp

Value:
#MATH highhp @maxhp*0.66
#MATH lowhp @maxhp*0.33
#IF (@hp >= @highhp) {%btncol( Button1, 10, black)}
#IF ((@hp > @lowhp) and (@hp < @highhp)) {%btncol( Button1, 14, black)}
#IF (@hp <= @lowhp) {%btncol( Button1, 12, black)}

ID:
Button1

Value:
@hp

Gauge Max:
@maxhp



...ok, so here's what's happening. The values on the gauge increment and decrement properly, but the colors don't change unless I click on the gauge.


Any and all ideas are welcome as I'm now at the point of trial-and-error.



Thanks,

Wasperine
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Jun 09, 2006 3:26 pm   
 
I take a slightly different approach that works for me. I basically keep redefining the button like so.

Code:
 #TRIGGER {<&%d{HP}/&%d{MxHP}hp &%d{M}/&%d{MxM}m &%d{Mv}mv &%d{XP}xp %dg (*)>} {
#IF (@HP <= @MxHP/2)
 {
  #GAUGE HP "HP" @HP @MxHP @Wimpy {} {high,yellow} {high,red}
 }
 {
  #VARIABLE WaHP %eval( @MxHP/2) "" Stats
  #GAUGE HP "HP" @HP @MxHP @WaHP "" "high,green" "high,yellow"
  }
}


If were to update it using your info it would look something like this.

Code:
 #TRIGGER {HP: &hp/&maxhp SP: &mana/&maxmana XP: &xp/&tnlxp } {

#MATH currentxp {%int( %replace( @currentxp, ",", ""))}
#MATH tnlxp {%int( %replace( @tnlxp, ",", ""))}
#MATH maxxp (@currentxp + @tnlxp)

#MATH highhp @maxhp*0.66
#MATH lowhp @maxhp*0.33

#IF (@hp <= @highhp)
 {
  #GAUGE HP "HP" @hp @maxhp @lowhp {} {high,yellow} {high,red}
 }
 {
  #VARIABLE WaHP %eval( @MxHP/2) "" Stats
  #GAUGE HP "HP" @HP @maxhp @highhp "" "high,green" "high,yellow"
  }
}


I haven't tested out the version I did for you so you may need to do a bit of tweaking.

Note: I didn't look up the button colors. It also assumes the name of your health button is HP. This is very important. If you do not do that it will creat a new gauge button.
_________________
Asati di tempari!
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Jun 09, 2006 3:47 pm   
 
That won't work because the value is only executed when you *click* on the button, you would need to put this in the caption using %functions

Old Value:
#MATH highhp @maxhp*0.66
#MATH lowhp @maxhp*0.33
#IF (@hp >= @highhp) {%btncol( Button1, 10, black)}
#IF ((@hp > @lowhp) and (@hp < @highhp)) {%btncol( Button1, 14, black)}
#IF (@hp <= @lowhp) {%btncol( Button1, 12, black)}

New Caption:
HP: @hp / @maxhp %if(@hp>=%eval(@maxhp*0.66),%btncol( Button1, 10, black),%if(@hp>%eval(@maxhp*0.33) and @hp<%eval(@maxhp*0.66),%btncol*Button1, 14, black),%if(@hp<=%eval(@maxhp*0.33),%btncol(Button1, 12, black))))


This is untested and all from memory but if the syntax is right it should work
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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