Re: Who MOTD

From: Pj Bean (pj_bean@hotmail.com)
Date: 11/08/01


>
Four infractions:
>
>1) Global variable will be for _everybody_, not just one person.  You want
    the pointer in 'struct char_data' or 'struct descriptor_data'.
>
*cough* umm not exactly, He wants to define one GLOBAL whomessage for
Everyone,
He has it right Just he needs to use
char whomessage;
or
char whomessage[50];

>2) You want 'whomessage', not '*whomessage'.  You're assigning a pointer,
    not writing to what the pointer goes to.
>
Hes right on this one ...but he doesnt explain this quite well,
ACMD(do_whomessage)
{
one_argument(argument,buf);
//DEPENDING ON WHAT YOU USED;
whomessage = str_dup("");
//....do they support str_dup in circle ?
//if not comment that out we dont neccessarily have to
//give mem to characters ...only big ones to keep it stable
whomessage = buf;
//OR
strcpy(whomessage,buf);
send_to_char("Who message set.\n\r",ch);
return;
}
Now you can use any of those assignments ...whichever compiles or fits your
fiddle, its real late right now so im not TOTALLY clear headed

>3) You need to allocate memory for that string.  'arg' is a magical global
    buffer that is used for many different functions.
>
I've never had to ...but use buf instead, its usually already sizable enough
for it.

>4) Failure to grasp C.  (To put it bluntly.)  Best solution there is a good
    C book and a lot of quiet reading.  It'll make more sense then.
>
its not a failure ...its called being a newbie, maybe he hasnt read a book
....thats pretty good for a newbie still...i remember back in the day when i
thought colorizing the who was the ultimate thing to do, ...there are alot
of informative tutorials in basic c online tho, try mudconnector.com or some
of go.to/muds links ...like darkhoths page and greyhtons, but alas ....he is
right ...it will make ALOT more sense :)

Anyways just my 2 cents




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST