limit.txt
snippets · 1.5 KB · 2010-03-30
limit: strips mortal colors from channels (merc.h changes).
Download « Back to the snippets list
in MERC.H add this
void strip_mortal_color(char *bufin, bool GLOBAL);
in all your channels ACT_COMM.C in like DO_GOSSIP and DO_SAY add this
if(!IS_IMMORTAL(ch))
strip_mortal_color( argument, TRUE );
before the output of sprintf(buf, "You gossip '%s'", argument); or similar expresion used to send the entire argument (what was said) to whomever it was going to.
for say i use FALSE and allow some codes not allowed for global channels.
in ACT_INFO.C under do_title add
/* not even imms can use these here */
strip_mortal_color( argument, TRUE );
before these lines of code
smash_tilde (argument);
set_title (ch, argument);
Last add this routine somewhere in a .c file i put it in ACT_NEWC.C
/*
* Strip reserved immortal only colors from strings
* These are based on my color codes yours may very some.
*
* Last the GLOBAL flag is used only when this affects everyone
* mud wide like gossip. For say i make this false and allow
* clear screen to be used by mortals.
*/
void strip_mortal_color(char *bufin, bool GLOBAL)
{
const char *pointer;
for(pointer = bufin; *pointer; pointer++)
{
if(*pointer == '{')
{
pointer++;
bufin++;
if(*pointer == 'z') /*blinking text reserved*/
{
*bufin = ' ';
}
if(*pointer == '`') /*line space reserved*/
{
*bufin = ' ';
}
if(*pointer == '0' && GLOBAL) /*used for clear screen reserved*/
{
*bufin = ' ';
}
}
bufin++;
}
}
Taka