Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Need some explanation of something I don't understand...

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

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Toy   (206 posts)  Bio
Date Tue 17 Feb 2004 10:30 AM (UTC)
Message
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...


It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Toy   (206 posts)  Bio
Date Reply #1 on Tue 17 Feb 2004 10:32 AM (UTC)
Message
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

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #2 on Tue 17 Feb 2004 04:38 PM (UTC)

Amended on Tue 17 Feb 2004 04:51 PM (UTC) by Greven

Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,104 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.