Login
User Name:

Password:



Register

Forgot your password?
Hi - Clean SmaugFuss map/description issue..
Dec 15, 2024 7:29 pm
By Samson
AFKMud 2.2.4
Dec 10, 2024 4:09 pm
By Samson
I3 and IMC
Dec 8, 2024 6:35 pm
By Remcon
Ubuntu 22.04.5 LTS
Dec 5, 2024 5:10 pm
By Remcon
SmaugFUSS 1.8/1.9
Nov 29, 2024 11:46 am
By Remcon
SWFOTEFUSS 1.5.1
Author: Various
Submitted by: Samson
SWRFUSS 1.4.1
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.5
Author: Various
Submitted by: Samson
AFKMud 2.2.4
Author: AFKMud Team
Submitted by: Samson
LOP 1.5
Author: Remcon
Submitted by: Remcon
Users Online
DotBot, AhrefsBot, Bing

Members: 0
Guests: 52
Stats
Files
Topics
Posts
Members
Newest Member
494
3,808
19,707
588
Mortrex

Today's Birthdays
There are no member birthdays today.
» SmaugMuds » Codebases » SWR FUSS » Weird Score Output
Forum Rules | Mark all | Recent Posts

Weird Score Output
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 May 7, 2011 11:48 pm   Last edited May 7, 2011 11:49 pm by Keirath
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts148
JoinedJan 24, 2008

 
I recently altered the classes on my MUD. After doing so, I began to receive strange output from score. I was receiving this:
combat            Level: 10    Max: 200   Exp: 40500        Next: 140733193438032
piloting             Level: 1     Max: 200   Exp: 0            Next: 140733193388532
engineering       Level: 1     Max: 200   Exp: 0            Next: 140733193388532


Which, I knew this wasn't correct because level was still outputting the correct values. To do some debugging I added a line to do_score to make it output as follows.
11|40500|50000) - combat            Level: 10    Max: 200   Exp: 40500        Next: 140733193438032
2|0|500) - piloting          Level: 1     Max: 200   Exp: 0            Next: 140733193388532
2|0|500) - engineering       Level: 1     Max: 200   Exp: 0            Next: 140733193388532


The format at the beginning is nextlevel|current exp|exp needed. It is the EXACT same code as later in the output. What could possibly be causing this strange output. I've been debugging for some time and I can't figure this out.


Also: if I type save and then score the output will be correct - but only that time.

Post is unread #2 May 7, 2011 11:53 pm   
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts148
JoinedJan 24, 2008

 
Ok even more bizarre. This was the code for outputing levels:
         ch_printf( ch, "%-15s   Level: %-3d   Max: %-3d   Exp: %-10ld   Next: %-10ld\r\n",


If you change Next this:
         ch_printf( ch, "%-15s   Level: %-3d   Max: %-3d   Exp: %-10ld   Next: %d\r\n",


It outputs correctly. So why would level work with the 10ld format and not score?
I am vastly confused here.

Post is unread #3 May 8, 2011 5:27 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
Something may be uninitialized, or initialized wrong. Or it could be attempting to put the wrong type of data in and overflowing.

Post is unread #4 May 8, 2011 6:49 pm   
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts148
JoinedJan 24, 2008

 
Why would level work and not score? When its the exact same code?

Post is unread #5 May 8, 2011 10:51 pm   
Go to the top of the page
Go to the bottom of the page

InfiniteAxis
Off the Edge of the Map
GroupAdministrators
Posts1,200
JoinedMar 21, 2006

 
Like I said, something could be initializing improperly in score, that is initializing properly in level, have you double checked that everything is identical, or run it through valgrind?

Post is unread #6 May 9, 2011 2:00 am   
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,697
JoinedJan 1, 2002

 
Actually both functions should be using %d instead of %ld because the exp_level() function in SWR FUSS returns an integer, not a long. So do_score AND do_level are both wrong, and it's probably just one of those bizarre flukes that it hasn't been caught before.

Post is unread #7 May 9, 2011 5:58 am   
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts148
JoinedJan 24, 2008

 
It must be one of those weird fluke things. I didn't even think about the %ld. I switched both over to %d. I think I just got so frustrated that the code was the exact same that I missed that.

At one point, I made score actually call do_level and it was still messing things up. But when called alone it worked. Meh, I don't know. Not something I understand but its working now. Thanks.

Pages:<< prev 1 next >>