06 Jan, 2012, arholly wrote in the 1st comment:
Votes: 0
Hello:
OK, so I got tired of having to retype the same lines of code every time I wanted to show someone's appearance, so I coded a bit and came up with this:
char *appearance_string(CHAR_DATA *ch)
{
int app;
char *tmp;
CHAR_DATA *wch;

app = get_curr_stat(wch, STAT_APP);
if (app == 0)
tmp = "Hideous";
else if (app == 1)
tmp = "Ugly";
else if (app == 2)
tmp = "Plain";
else if (app == 3)
tmp = "Average";
else if (app == 4)
tmp = "Attractive";
else
tmp = "Radiant";

return tmp;
}


It is then called in my who function like this:
sprintf( buf, "{R[{Y%s %6s{R]{x %s%s%s%s%s\n\r%s{R%s{x%s{R%s{x\n\r",
appearance_string(wch),
wch->sex == 0 ? "Sexless" : wch->sex == 1 ? "Male" : "Female",
IS_SET(wch->act2, ACT2_STORY) ? "{R[{YST{R]{x": "",
IS_SET(wch->comm, COMM_AFK) ? "{R[{YAFK{R]{x": "",
wch->name,
wch->surname[0] != '\0' ? " ":"",
wch->surname,
" ", /* golden tule spacing */
fRPOK ? " [": "",
IS_NPC(wch) ? "" : !fRPOK ? wch->pcdata->title : wch->pcdata->rpok_string,
fRPOK ? "]": "");

But then whenever I use the who command, it crashes. Any thoughts? Thanks in advance.

Arholly
06 Jan, 2012, KaVir wrote in the 2nd comment:
Votes: 0
wch is unitialised, strange the compiler didn't pick it up.
06 Jan, 2012, arholly wrote in the 3rd comment:
Votes: 0
slaps hand to forehead. Got it. Thanks, that fixed it.
0.0/3