who format

Posted by Malakai on Fri 29 Mar 2002 09:26 AM — 3 posts, 16,003 views.

#0
In the gameset.txt file and gameedit there is a setting for default_who_format. Is there any others that are available besides "dawn" or do I just need to code it in manually?

Thank you in advance.
United Kingdom #1

Who formats are actually implemented as something that can be unique for every player... the thing is though (in dawn's the default configuration) players don't have access to the command used to change their  who format to something different than the default (whoformat).


[NESW in v16206 mremvill.are - 02:53:32 - 8:03am>wiz whof
whoformat         [ 92]   
Type 'wiz <level>' to filter by level, 'wiz <partofword>' to filter on words.
[NESW in v16206 mremvill.are - 02:53:39 - 8:04am>

Basically when anyone uses the who command, the mud checks if their whoformatter is set to the default.  If so their wholist is formatted using the default format set in gameedit.  This mudwide default can be easily changed in gameedit, from the sounds of your email, you may have been manually editing gameset.txt instead of using gameedit (chuckle).  While there are a few things in gameset.txt which can't changed in gameedit most can.  The ones that require manual editing of gameset.txt are the more obscure/advanced configuration settings which new imps shouldn't be playing within unless they understand what they are doing.

The mudwide default whoformat can be set using the setwhoformat command in gameedit.


[NESW in v16206 mremvill.are - 02:39:55 - 5:50am>gameedit
syntax: gameedit confirm
This command takes you into the game settings editor.
[NESW in v16206 mremvill.are - 02:39:56 - 5:50am>gameedit confirm
Entering game settings editor.
[NESW in GameEdit done commands vshowflags>setwhofo
syntax: setwhoformat <format>
Where the default format is one of the following:
   default
   dawn
   storm
   just_names
Your who format is currently set to default.
[NESW in GameEdit done commands vshowflags>setwhofo storm
Default Who format changed from default to storm.
[NESW in GameEdit done commands vshowflags>setwhofo just
Default Who format changed from storm to just_names.
[NESW in GameEdit done commands vshowflags>setwhofo dawn
Default Who format changed from just_names to dawn.
[NESW in GameEdit done commands vshowflags>sethofo default
Default Who format changed from dawn to default.
[NESW in GameEdit done commands vshowflags>

The code for creating your own who format is in whofmt.cpp, the most trival shown:

/**************************************************************************/
// example whoformat function - about as simple as it gets
char *whoformat_just_names( char_data *ch, char_data *wch, bool two_column)
{
    return wch->name;
}
/**************************************************************************/

Within who.cpp (at the top) you need to add your custom who formatter to the who_formatter table.

/**************************************************************************/
// prototypes for the whoformat functions in whofmt.cpp
char *whoformat_dawn( char_data *ch, char_data *wch, bool two_column);
char *whoformat_storm( char_data *ch, char_data *wch, bool two_column);
char *whoformat_just_names( char_data *ch, char_data *wch, bool two_column);

/**************************************************************************/
struct  who_format_type who_formatter [] =
{
    // name,    function ran,       use two columns when heaps of players on
    { "default",    NULL,           false       }, // spacer 
    { "dawn",   whoformat_dawn,     true        }, 
    { "storm",  whoformat_storm,    false       }, 
    { "just_names", whoformat_just_names,   false }, 
    { "", NULL, false}
};
/**************************************************************************/

Hope this makes things clear,

- Kal

#2
crystal :) thanks for the help! Awesome codebase btw, can't stress that enough. You've clearly put a lot of time and effort into it and it's really user friendly. So hats off to you my friend!