Re: [CODE] showstats command help

From: Greg Buxton (gbuxton@maple.he.net)
Date: 01/23/03


We'll do this in reverse order to help give some sense to this.

> Im looking for some coding help here, I seen something similar to this
> posted on another mailing list, and I tried to implement it into my 3.1
> mud. Everytime I excute it, my mud crashes. I have no clue whats wrong, I
> just wanted to print out these stats to a player when they want to see
them.

The code helped to figure out the problem, but it also helps when you also
provide a bit more information.  gdb info from the crash, etc.

But, based off the code we'll assume you're new to both the Circle list
and to C code in general, so let's take a look at each line, one at a time.

> ACMD(do_yummy)
> {
>            send_to_char(ch," Your stats are: \r\n");

So far so good.

>            send_to_char(ch," Str: %2d%s%s\r\n", GET_STR(ch), GET_ADD(ch));

You've got three format chars '%2d%s%s' and are giving it two numeric
arguments.

This isn't conductive to a happy compiler.

try:

  send_to_char(ch, " Str: %2d/%2d\r\n", GET_STR(ch), GET_ADD(ch));

>            send_to_char(ch," Wis: %2d\r\n", GET_WIS(ch),(ch));

You've got one format char, but are giving it two arguments, a number and
a struct char_data structure for the character (ch).

try:

  send_to_char(ch, " Wis: %2d\r\n", GET_WIS(ch));

>            send_to_char(ch," Con: %2d\r\n", GET_CON(ch));
>            send_to_char(ch," Dex: %2d\r\n", GET_DEX(ch));
>            send_to_char(ch," Int: %2d\r\n", GET_INT(ch));
>            send_to_char(ch," Cha: %2d\r\n", GET_CHA(ch));

All good there.

>            send_to_char(ch," Hitroll: %2d\r\n", points.hitroll(ch));

try:

  send_to_char(ch, " Hitroll: %d\r\n", GET_HITROLL(ch));

>            send_to_char(ch," Damroll: %d\r\n", points.damroll(ch));

try:

  send_to_char(ch, " Damroll: %d\r\n", GET_DAMROLL(ch));

> }

- Greg
Shadows of Amber
shadows.drathus.org 5200

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT