Changing Stats

Posted by Toy on Fri 19 Nov 2004 10:26 PM — 4 posts, 18,599 views.

#0
I went through and changed all calls to the 7 stock stats in SMAUG to be just 4 stats: strength, psyche, endurance and warfare. I compiled cleanly, booted and received this upon log in:

Fri Nov 19 18:21:50 2004 :: The Worlds of Amber ready at address PICCOLO on port 3000.
Fri Nov 19 18:21:54 2004 :: Sock.sinaddr: 127.0.0.1, port 3553.
Fri Nov 19 18:21:59 2004 :: [*****] FILE: ../player/t/Toy LINE: 64
Fri Nov 19 18:21:59 2004 :: [*****] BUG: Fread_char: no match: AttrMod
Fri Nov 19 18:21:59 2004 :: [*****] FILE: ../player/t/Toy LINE: 64
Fri Nov 19 18:21:59 2004 :: [*****] BUG: Fread_char: no match: AttrMod
Fri Nov 19 18:21:59 2004 :: Toy@127.0.0.1((ident not active)) has connected.

Looked at my fread_char and I couldn't seem to find the problem. Then, just trsting other things, I typed score, and the mud crashed. Not sure what's wrong. When I mstat myself, everything shows fine, but score will drop the segment core.

Anyone have any ideas? I'll post a backtrace on do_score in a minute.

-Toy

-EDIT-
Offhane, and I don't know if this will matter any, but oldscore works fine as well.
Amended on Fri 19 Nov 2004 10:32 PM by Toy
#1
Breakpoint 1, do_score (ch=0xa293288, argument=0x23eb55 "") at player.c:43
43 if (IS_NPC(ch))
(gdb) n
49 set_pager_color(AT_SCORE, ch);
(gdb) n
51 pager_printf(ch, "\n\r&zScore for %s%s%s.&w\n\r", ch->pcdata->pretitle, ch->nam
e, ch->pcdata->title);
(gdb) n
52 if ( get_trust( ch ) != ch->level )
(gdb) n
55 send_to_pager("&w--------------------------------------------------------------
--------------\n\r", ch);
(gdb) n
57 pager_printf(ch, "&zLEVEL: &w%-3d &zRACE : &w%-10.10s &z
PLAYED: &w%d hours\n\r", ch->level, capitalize(get_race(ch)), (get_age(ch) - 17) * 2);
(gdb) n
58 pager_printf(ch, "&zYEARS: &w%-6d &zCLASS: &w%-12.12s &zLOG IN: &w%s\
r", get_age(ch), capitalize(get_class(ch)), ctime(&(ch->logon)) );
(gdb) n
60 if (ch->level >= 15
(gdb) n
63 pager_printf(ch, "&zSTRENGTH : &w%2.2d &zHITROLL: &w%-4d
&zSAVED: &w%s\r", get_curr_strength(ch), GET_HITROLL(ch), ch->save_time ? ctime(&(ch->save_
time)) : "no save this session\n" );
(gdb) n
64 pager_printf(ch, "&zPSYCHE : &w%2.2d &zDAMROLL: &w%-4d
&zTIME: &w%s\r", get_curr_psyche(ch), GET_DAMROLL(ch), ctime(&current_time) );
(gdb) n
72 if (GET_AC(ch) >= 101)
(gdb) n
74 else if (GET_AC(ch) >= 80)
(gdb) n
76 else if (GET_AC(ch) >= 55)
(gdb) n
77 sprintf(buf, "shabby and threadbare");
(gdb) n
103 if (ch->level > 24)
(gdb) n
104 pager_printf(ch, "&zENDURANCE : &w%2.2d &zARMOR: &w%4.4d, %s\n\r"
, get_curr_endurance(ch), GET_AC(ch), buf);
(gdb) n
108 if (ch->alignment > 900)
(gdb) n
110 else if (ch->alignment > 700)
(gdb) n
112 else if (ch->alignment > 350)
(gdb) n
114 else if (ch->alignment > 100)
(gdb) n
116 else if (ch->alignment > -100)
(gdb) n
117 sprintf(buf, "neutral");
(gdb) n
127 if (ch->level < 10)
(gdb) n
130 pager_printf(ch, "&zWARFARE : &w%2.2d &zALIGN: &w%+4.4d, %-14.14s
&zITEMS: &w%5.5d (max %5.5d)\n\r", get_curr_warfare(ch), ch->alignment, buf, ch->carry_num
ber, can_carry_n(ch));
(gdb) n
132 switch (ch->position)
(gdb) n
159 sprintf(buf, "standing");
(gdb) n
191 pager_printf(ch, "&zPOS'N: &w%-21.21s &zWEIGHT: &w%5.5d (MAX %7.7d)\n\r", ch->
carry_weight, can_carry_w(ch));
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x610d2874 in memchr () from /home/KK and Li Li/smaug/area/cygwin1.dll
(gdb)

This is what I got for do_score. Been looking through the fread_char's info and haven't been getting any luck.

-Toy
Canada #2
Ok, as for your pfiles, it looks like its may still have some of the old data in it, like the attribute modifications for some of the stats.

As for score, the issue, obviously, is the last line before it crashed:
pager_printf(ch, "&zPOS'N: &w%-21.21s &zWEIGHT: &w%5.5d (MAX %7.7d)\n\r", ch->
carry_weight, can_carry_w(ch));
You'll notice two things, first that there are 3 variables to be printed, but only 2 are supplied, your missing the string for someones position. Secondly, and more likely why it crashed, is that it was trying to print an integer variable as a string, since it matched the first %* with the first supplied argument. If you add a 3rd argument before ch->carry_weight(the string representing their position), it should work out.
#3
Wow. Thanks Greven. Been looking at that all day and just kept looking past it. Now all I gotta do is track down and fix my AttrMod issues.

-Toy

--EDIT--------------------------------------------------------

Added to my "DUH" moments. My AttrMod issues came from a missing call at the in fread_char:

fMatch = TRUE;