Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Yesterday, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, DotBot

Members: 0
Guests: 15
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » 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, 9:48 pm   Last edited May 7, 2011, 9:49 pm by Keirath
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
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, 9:53 pm
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
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, 3:27 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
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, 4:49 pm
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

Why would level work and not score? When its the exact same code?
       
Post is unread #5 May 8, 2011, 8:51 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
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, 12:00 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
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, 3:58 am
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
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 >>