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


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Fri Jul 06, 2007 4:26 pm   

Format Strings with %format()
 
Hi, I am trying to manage Achaea's new elixir program from a concoction maker’s point of view. I have managed to get various lists and am planning to expand vial ID names by simpler number for pouring, topping, and filling commands and for spoken reference. My list is nice, though I have little idea what %format really does.

These are example prints:

Health Artifact Vials:

vial133434 1 200 sips, 0 to do
vial164685 2 100 sips, 1 to do
vial131045 3 26 sips, 1 to do

Here 200 100 and 26 need a special field.

Empty Artifact Vials:

vial97520 1 0 sips, 2 to do
vial88315 2 0 sips, 2 to do
vial162146 3 0 sips, 2 to do
vial156144 4 0 sips, 2 to do

And here the item (simplified vial) numbers need a field too. Those numbers could become three digits, this is new codes

***

And this is what I have managed to code so far:


#sh %format( " &-15s &-6s", %key @ncount, %val sips~, %item( %db( @BaseVialsAll, %key), 2) to do)

or I think I could say this as,

#sh %format( " &-15s &-6s", S N, N sips~, N to do)

Could anyone offer suggestions?
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Fri Jul 06, 2007 9:48 pm   Got it
 
I confused the term decimal places with the term decimal points, sorry, why it was so hard
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