Re: [code] [newbie] Race crash

From: Allan M. Grant (agrant@negia.net)
Date: 12/19/96


Mud Administration wrote:
> 
> I wanted to do the SAME thing for my "showplay" file...  and it did the SAME
> thing.
> Errored out at every corner.  So I did this...
>     switch (GET_RACE(ch)) {
>     case RACE_HUMAN:
>       strcpy(racename, "Hu");
>       break;
>     case RACE_ELF:
>       strcpy(racename, "El");
>       break;
>     case RACE_DWARF:
>       strcpy(racename, "Dw");
>       break;
>     case RACE_ORC:
>       strcpy(racename, "Or");
>       break;
>     case RACE_GIANT:
>       strcpy(racename, "Gi");
>       break;
>     case RACE_LIZARD:
>       strcpy(racename, "Li");
>       break;
>     case RACE_GNOME:
>       strcpy(racename, "Gn");
>       break;
>     case RACE_UNDEAD:
>       strcpy(racename, "UD");
>       break;
>     default:
>       strcpy(racename, "--");
>       break;
>     }
> 
> sprintf(buf, "Race:  %s", racename);
> 
> On 19-Dec-96, Allan M. Grant wrote:
> > I got the whois to work and now I want to enchance it.
> > I was able to do this:
> >       sprintf(buf, "%s[%2d %s] %s %s", buf, GET_LEVEL(victim),
> >                     CLASS_ABBR(victim), GET_NAME(victim),
> >                     GET_TITLE(victim));
> > It works like this. I get something like:
> > >whois Pheonix
> > [54 pa] Pheonix the God of Eternal Cyberflames
> 
> > Then I wanted to add my race as well so that instead of getting [54 pa]
> > I would get something like [Half-Elf 54 pa] and here is what I got:
> >       sprintf(buf, "%s[%s %2d %s] %s %s", buf, GET_RACE(victim),
> > GET_LEVEL(victim),
> >                     CLASS_ABBR(victim), GET_NAME(victim),
> >                     GET_TITLE(victim));
> > When I do this and try whois the mud crashes. I tried RACE_ABBR instead
> > even though I want the whole race name. And I get unresolved external. I
> > added and extern for it below the extern for class_abbr and still I get
> > an unresolved external. What is wrong with both of those?
> 
> > Thanks,
> 
> > Pheonix the Newbie Implementor Who Wants to Learn
> > +-----------------------------------------------------------+
> > | Ensure that you have read the CircleMUD Mailing List FAQ: |
> > |   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
> > +-----------------------------------------------------------+
> 
> --
> L8r....
> 
>         Jeremy Davis(MadMax, Killer)
> 
>   CEO - The UnForgiven Enterprises (TUF Ent)
>       http://www.aardvarkol.com/tufent
> 
>    Implementor of Lost Order of the DAMNED
> http://www.aardvarkol.com/tufent/mudstuff.html

Did it... didn't help...

I am out of ideas.. :)

What do I do know?

P/S I had to use buf1 instead of racename (which could be the problem)
because I was getting errors with racename. I guess I didn't create it
first..
How do I create it?
I guess it would be like this:
    CREATE(racename, struct char_data, 1);
I don't know...

Pheonix
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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