Re: [NEWBIE] score

From: Xual (xual@danathara.dhs.org)
Date: 05/06/99


On Thu, 6 May 1999, Shaun Bourque wrote:

> just wanted to add a line to my score sheet, didnt think i'd hafta call
> congress for a vote.
> when compiling gives me these errors
> warning: format argument is not a pointer (arg 5)
> warning: format argument is not a pointer (arg 6)
> warning: format argument is not a pointer (arg 7)
>
> and refers to this line of code
>
> sprintf(buf, "%s: You are a %d year old %s %s %s. Your level is %d.",
>  GET_NAME(ch), GET_AGE(ch), GET_SEX(ch), GET_RACE(ch), GET_CLASS(ch),
> GET_LEVEL(ch));
> send_to_char(buf, ch);

GET_SEX() GET_RACE() and GET_CLASS() all point to char variables, not
strings.  The way you have it set would produce this output:

Name: You are a 17 year old m d w. Your level is 1.

Assuming a male dwarven warrior is typing score.  You want to access the
string arrays with the correct name, such as genders[], pc_class_types[]
and pc_race_types[].  Try this:

sprintf(buf, "%s: You are a %d year old %s %s %s. Your level is %d.",
        GET_NAME(ch), GET_AGE(ch), genders[(int)GET_SEX(ch)],
        pc_race_types[(int)GET_RACE(ch)],
        pc_class_types[(int)GET_CLASS(ch)], GET_LEVEL(ch));

You'll also have to add extern declarations for the above arrays at the
top of the file, ie:

extern const char *pc_class_types[];

"Misery is boundless"
        -Xual the Torturer, on the Eve of the Sundering.

Danathara Online RPG
telnet://danathara.dhs.org:4000


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST