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


Joined: 09 Oct 2003
Posts: 40

PostPosted: Thu Jun 17, 2004 5:27 am   

Coloring Hp Bars
 
Lightbulb and who ever else could answer this I would be very thankfull.

Okay once again I'm trying to edit text that I see. This time I'm trying to color my hp bar. Not the entire bar but sections of it. To top it all off tho, I'm trying to do it all with one trigger.

Code:

Hp:[477/477] Sp:[306/306] S:[100%] H:[5%] C/M:[2/0/30%] G:59.698 E:Bleed


Thats my hp bar.

This is how I would like it to look..

Code:

<font color="yellow">Hp:[477/477]</font id="yellow"> <font color="green">Sp:[306/306]</font id="green"> <font color="orange">S:[100%]</font id="orange"> <font color="red">H:[5%]</font id="red"> <font color="black">C/M:[2/0/30%]</font id="black"> <font color="blue">G:59.698 </font id="blue"><font color="maroon">E:Bleed</font id="maroon">


I know there is a way to do it all in one trigger. I did it once with a much older version of zmud. (4.2 I think). But I just can't remember how to do it anymore. So just incase, you guys need it here is the code that i have in my hpbar trigger already.

Code:

Pattern:
Hp:~[(%d)/%d] Sp:~[(%d)/%d] S:~[(%d)~%] H:~[(%d)~%] C/M:~[(%d)/(%d)/(%d)~%] G:(%x)

Value:
#if (@gxpr > 0) {
  #math total_gxp (@total_gxp + @gxpr)
  #add gxp_round 1
  average_gxp=%eval( %float( @total_gxp) / @gxp_round)
  average_rtl=%int( %eval( %eval( 100-%float( %8))/%format( 4, @average_gxp)))
  }
#say Hp:~[%format( "&3.0n", %eval( %1-@hpl))%repeat( " ", 6)Sp:~[%format( "&3.0n", %eval( %2-@spl)) %repeat( " ", 4) S:~[%format( "&3.0n", %eval( %3-@stiml))%repeat( " ", 3)H:~[%format( "&2.0n", %eval( %4-@heatl))%repeat( " ", 8)G:%format( 3 , %eval( %8-@gxpl)) AG:%format( 3, @average_gxp) R: @average_rtl
hpl=%1
spl=%2
stiml=%3
heatl=%4
gxpl=%8
repower=%7
air_drops=%5
nuke=%6


Once again if you guys could help that would be awesome. Thanks!

Phanku
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jun 17, 2004 2:41 pm   
 
Code:
Use #PCOL or %ansi.

Certainly it can be done in one trigger, but you should not impose artificial restrictions when you ask others for solutions. There is no reason to combine this with the trigger you use to set variables and good reason not to.

<b>#TR</b> {(Hp:~[<font color="purple">%d</font id="purple">/<font color="purple">%d</font id="purple">~]) (Sp:~[<font color="purple">%d</font id="purple">/<font color="purple">%d</font id="purple">~]) (S:~[<font color="purple">%d</font id="purple">~%~]) (H:~[<font color="purple">%d</font id="purple">~%~]) (C/M:~[<font color="purple">%d</font id="purple">/<font color="purple">%d</font id="purple">/<font color="purple">%d</font id="purple">~%~]) (G:<font color="purple">%x</font id="purple">) (E:<font color="purple">*</font id="purple">)} {<b>#PCOL</b> yellow <font color="blue">%x1</font id="blue">;<b>#PCOL</b> green <font color="blue">%x2</font id="blue">;<b>#PCOL</b> orange <font color="blue">%x3</font id="blue">;<b>#PCOL</b> red <font color="blue">%x4</font id="blue">;<b>#PCOL</b> black <font color="blue">%x5</font id="blue">;<b>#PCOL</b> blue <font color="blue">%x6</font id="blue">;<b>#PCOL</b> maroon <font color="blue">%x7</font id="blue">} {} {nocr|prompt}

You may not have read my complaints elsewhere about the use of [co<b></b>de] and [/co<b></b>de]. Most people do this in the mistaken belief that it will make a script easier to read. The truth is usually the opposite, it makes both the script and the remainder of the topic much harder to read, since the usual effect is to make the topic several screens wide. As you've probably already noticed, they prevent the forum's wordwrap feature from operating. With wordwrap off, the post-width is forced to the length of your longest line. You remove your [co<b></b>de] tags and I'll remove mine.
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