Re: [NEWBIE] Long names for PC's

From: Mo McKinlay (M.McKinlay@BEKON.COM)
Date: 11/09/98


> How can I make it so that a PC can have a longer name when they emote, say,
> tell, or otherwise act or appear..

I'm not sure if this is the best way, but it's the way I did it...

Add something like char prefix[12] into the player_specials_saved struct,
and make sure it's given a default value when chars. are created (to be on
the safe side). Then, add something like this into utils.h:

#define GET_PREFIX(ch) ((ch)->player_specials.saved.prefix)

After that, modify the perform_tell, etc, functions so that instead of
this:

sprintf(buf, "$n tells you, '%s'", arg);

You have this: (excuse the line wrap)

sprintf(buf, "%s%s$n tells you, '%s'", GET_PREFIX(ch),
(GET_PREFIX(ch)[0]?" ":""), arg);

Alternatively, if you're brave, you could modify the act() function to do
the same thing.

The reason for the two %s's at the beginning is this: the first is the
prefix string itself, using the macro from utils.h. The second is
optionally a space between the name and the prefix - so you don't get
this:

hasprefix bob tells you, 'blah'

and

 bill tells you, 'blah blah'
^
|- Notice the space there - that looks messy, hence the second %s.

When the first character of GET_PREFIX(ch) is 0 (i.e. the PC has no
prefix), the (GET_PREFIX(ch)?" ":"") returns an empty string, otherwise it
returns a space. There is a way around this by making the function that
sets the prefix append a space to it if it's non-blank, but I didn't think
of that when I first did it.

I know that's not _quite_ what you asked for, but I'm sure you should be
able to get it to suit your needs.

Regards,

--
Mo McKinlay
Development and Support Manager
IDSS Department
Bekon
2 North Place
Stockport
Cheshire
SK1 1HH
T: +44 (0) 161 476 1300 x224
F: +44 (0) 161 476 1311
E: M.McKinlay@bekon.com
W: http://www.bekon.com/idss/


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



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