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

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

hasprefix bob tells you, 'blah'


 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.


Mo McKinlay
Development and Support Manager
IDSS Department
2 North Place
T: +44 (0) 161 476 1300 x224
F: +44 (0) 161 476 1311

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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