Re: making variable text conform to a constant space

dex@darknet.com
Date: 05/23/96


On Thu, 23 May 1996, Mudder wrote:

> I have a problem I have been trying to work out for a few days now.
> what I am trying to do is, as an example, make a box for some variable
> output to a player, Like exp or gold.
>  
> this is what I want for output:
> 
>             ______________________________________________
>            |                                              |
>            |   Exp to Level: 12345   current Exp: 123456  |
>            |                                              |
>            |   Gold on hand: 12345  Gold in bank: 123456  |
>            |______________________________________________|
> 
> 
> however, this is what I get :(
> 
>             ______________________________________________
>            |                                              |
>            |   Exp to level: 123456  current Exp: 1234567   | <--
>            |                                              |      |
>            |   Gold on hand: 1234   Gold in bank: 12345 |    <---|                      
>            |______________________________________________|      |
>                                                                  |
> how do I make the box stay in place \____________________________|
> when the variables change?          /

  Allocate a certain number of digits for each. If you think the maximum
amount of gold a player will ever have is about 1 million, use a 7 digit 
number in your statment, like:

  sprintf(buf, "|  Exp to level: %7d  Current Exp: %7d |\r\n", 
    GET_GOLD(ch), GET_EXP(ch));

 this should prolly do it for all values.


 Dex Man       (aka Shade)
 



This archive was generated by hypermail 2b30 : 12/18/00 PST