Re: code

From: Casper Lund (ncl@mailhost.net)
Date: 07/13/96


On Fri, 12 Jul 1996 10:18:56 -0500, you wrote:

>Mind if I ask you a couple things?  First, I've just gotten my race system
>in(I just started) and I tried to edit some commands.  I wrote this in
>act.informative.c, command do_score:
>
>sprintf(buf, "%sName: %s     Race: %s      Class: %s", buf, GET_NAME(ch),
>GET_RACE(ch), GET_CLASS(ch));
>
>I kept getting a "Format argument is not a pointer(arg 5)" and arg 6, I
>think it was.  What is wrong with it?  Do I have to define something?

GET_RACE and GET_CLASS only returns a value which you then have to 
"convert" into the description of the approprtiate race and class.

Take a look at this code... This is probably what it would end up
looking like:

sprintf(buf, "%sName: %s   Race: ", buf, GET_NAME(ch));
switch(GET_RACE(ch)) {
  case RACE_HUMAN:
    strcat(buf, "Human");
    break;
  case RACE_DWARF:
    strcat(buf, "Dwarf");
    break;
  case RACE_ELF:
    strcat(buf, "Elf");
    break;
  default:
    strcat(buf, "[bug!!]");
    break;
}
sprinttype(ch->player.class, pc_class_types, buf2);
sprintf(buf, "%s   Class: %s\r\n", buf, buf2);


--
Casper Lund
ncl@mailhost.net
//Incoming mail forwarded via the PObox II remailer



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