Need some explanation of something I don't understand...

Posted by Toy on Tue 17 Feb 2004 10:30 AM — 3 posts, 14,804 views.

#0
I've rearranged the do_score command to check for num_punct to add punctuation to each part of a characters score. I ran into something wierd I don't understand.

When I log in as a newbie, it shows this:
XP : 0 MANA: 100 of 100 MKILLS: 00000

And at Level 54, Max level, it shows this:
XP : 93,048,125 MANA: 30,000 of 30,000 MKILLS: 00045

Here's the code from player.c

	pager_printf(ch, "&CXP   : &W%-9s       ", num_punct(ch->exp) );
	pager_printf(ch, "&CMANA: &B%-5s&C ", num_punct(ch->mana) );
	pager_printf(ch, "of &b%5s ", num_punct(ch->max_mana) );
	pager_printf(ch, "&CMKILLS:  &W%-5.5d    ", ch->pcdata->mkills );


Now if the code applies to both both of the character's files, why does it move the MANA over 1 space? Is there anyway I can set this up so the space stays at a maximum length, without moving one way or another, no matter what the character's exp is at? Because I notice that it seems to move based on how much exp a character has. And can someone explain to me why it does that?

-Toy has been beating this one all day with a stick trying to get it to work right...

#1
Ok, for some reason the post didn't post the way exactly the way I wrote it.. so here's exactly the problem:

The word MANA moves over one space in a character's score based on how much exp that person has and I'm trying to correct it.

-Toy
Canada #2
If you look at the line outputted by num_punct(ch->exp) ), you have the %-9s set up to display a minimum of 9 characters, however, it is printing out 10, including the ","s. So, if you change it to %-10s, that should correct the problem if they have an 8 digit experience. The best way would be to advance yourself to the top level, and see who many digits, including ","s there are. If its "999,999,999,999", then you have 15, so set it as such.

Also, if you want more options on how to set the %s characteristics, check out "man format" in your shell.

Hope that explains it.
[EDIT] Then again, you may have something else going on, because you put in manual spacsat the %s, but they are not showing up.