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
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Mon Dec 25, 2006 6:28 pm   

spacing setup
 
I've been trying to come up with a way to preserve dividers in aliases that display some tracked information.
so an alias, gxpstats

Gxp Rate
Outstanding : 199| 5.73
Very High : 2278 | 65.57
High : 650 | 18.71
Good : 3 | 0.09
Average : 306 | 8.81
Low : 38 | 1.09
Very Low : |
Total : 3474

i'm using this to compare different setups to see what gives the highest percent of top end gxp, so i'm wondering how i could insert a set number of spaces, the closest setup i was thinking of was using %eval(5-%len(@rate.outstanding)) to give how many spaces i would need, but i just don't know how to incorporate this information. my script looks like:

Code:

#math ratetotals (@rate.outstanding+@rate.veryhigh+@rate.high+@rate.good+@rate.average+@rate.low+@rate.verylow)
#show "                Gxp Rate                  "
#show "Outstanding  : "@rate.outstanding"| "%format( "&f", %eval( @rate.outstanding/%format( 2, @ratetotals)*100))""
#show "Very High  : "@rate.veryhigh"  | "%format( "&f", %eval( @rate.veryhigh/%format( 2, @ratetotals)*100))""
#show "High       : "@rate.high"      | "%format( "&f", %eval( @rate.high/%format( 2, @ratetotals)*100))""
#show "Good       : "@rate.good"      | "%format( "&f", %eval( @rate.good/%format( 2, @ratetotals)*100))""
#show "Average    : "@rate.average"   | "%format( "&f", %eval( @rate.average/%format( 2, @ratetotals)*100))""
#show "Low        : "@rate.low"       | "%format( "&f", %eval( @rate.low/%format( 2, @ratetotals)*100))""
#show "Very Low   : "@rate.verylow"   | "%format( "&f", %eval( @rate.verylow/%format( 2, @ratetotals)*100))""
#show "Total      : "@ratetotals""
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Mon Dec 25, 2006 6:30 pm   
 
i don't know if i made it clear, the problem i'm trying to solve with this script is to have the | line up in a column which i need to have a dynamic way to set the spaces using the length of the rate values
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4689
Location: Pensacola, FL, USA

PostPosted: Mon Dec 25, 2006 7:16 pm   
 
try using the length set feature of %format(), it will require more indepth format calls, but it will get what you want done.

#SHOW %format("&10.0s &6.0f &s &6.2f", "Good", @rate.good, "|", %eval(@rate.good/@ratetotals*100))
_________________
Discord: Shalimarwildcat
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Mon Dec 25, 2006 8:16 pm   
 
#show %format( "&s &7s &1.0f &s &3.2f", "Good", ":", @rate.good, "|", %eval( @rate.good/%format( 2, @ratetotals)*100))

i still am running into the problem though of having a dynamic way to change the value of the 4th &s, there isn't a way to do the math that i could find, i tried to do &{%eval(5-%len(@rate.good))}s just to fool with it, used "", <>, ect. any ideas or could you be more explicity in how to do it shalimar? i want the | to line up if that value is 1, 12, 123, 1234 and so on.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4689
Location: Pensacola, FL, USA

PostPosted: Mon Dec 25, 2006 10:04 pm   
 
If you want to ensure that one parameter lines up, first ensure that every parameter before it lines up, specifically your first parameter has no length, whereas mine did.

#show %format( "&9s &1s &5.0f &1s &6.2f", "Good", ":", @rate.good, "|", %eval( @rate.good/%format( 2, @ratetotals)*100))

You want to force lengths on every parameter to ensure they line up, the length must be at least as long as the longest variable that goes into it. If you are unsure of how large it could get, it is safer to guess too much then not enough.
_________________
Discord: Shalimarwildcat
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