/*******************************************************************************
* _ | File Name: immonlycolor.txt
* / \ _-' | Description: This is a immortal only color function
* _/| \-''- _ / | It disallows certain color codes to be
* __-' | \ | used in certain functions and here is
* / \ | how it works.
* / "o. |o | |
* | \ ; |
* ', |
* \_ __\ | (c) 2000-2001 TAKA
* ''-_ \.// | (c) 2000-2001 The GhostMud Project Team
* / '-____' |
* / | You may use this code under GNU license restriction
* _' The Wolf | 1) This header block remains in the code.
* _-' strikes! | 2) You email me at a_ghost_dancer@excite.com
*_________________________| letting me know you are using this code
* please incluse your name, your mud name
* All rights reserved your mud address, your email and this file
* GhostMud is copyrighted name.
* by TAKA 3) In your help files mention me where appropriate
* IE: help snippets.
* 4) Your use of this snippet must not violate any
* ROM, MERC or DIKU license.
*********************************************************************************/
In MERC.H
/*
* strip color code function for support of color limiting for commands
* by TAKA of GhostMUD June 2001
*/
void strip_mortal_color(char *bufin, bool GLOBAL);
In ACT_NEWC.C (or at the bottom of any ACT_xxx.C)
/*
* strip color code function for support of color limiting for commands
* by TAKA of GhostMUD June 2001
*
* NOTE: You may need to use a different symbol preceeding color
* or for the color codes listed. You may also wish to exclude
* more or less colors. Also not everyone has clear screen
*/
void strip_mortal_color(char *bufin, bool GLOBAL)
{
const char *pointer;
for(pointer = bufin; *pointer; pointer++)
{
if(*pointer == '{')
{
pointer++;
bufin++;
if(*pointer == 'z') /* blinking */
{
*bufin = ' ';
}
if(*pointer == '`') /* line feed */
{
*bufin = ' ';
}
if(*pointer == '0' && GLOBAL) /* clear screen */
{
*bufin = ' ';
}
}
bufin++;
}
}
Now in ACT_COMM.C I have global consolidated channels code so fo GhostMUD do this
find
void open_channel ( CHAR_DATA *ch, char *argument, char *type, const int bitname)
{
char *buf2;
char buf[MAX_INPUT_LENGTH + 80];
DESCRIPTOR_DATA *d;
if (argument[0] == '\0' )
{
if (IS_SET(ch->comm,(bitname)))
{
sprintf( buf, "{W%s {Gchannel is now {RON.{x\n\r", type);
send_to_char( buf ,ch);
REMOVE_BIT(ch->comm,(bitname));
}
else
{
sprintf( buf, "{W%s {Gchannel is now {ROFF.{x\n\r", type);
send_to_char( buf, ch);
SET_BIT(ch->comm,(bitname));
}
}
else
{
add right here the following code
/*
* This limits color codes blink, clear screen and line feed
* over global channels to only immortals
* Taka
*/
if(!IS_IMMORTAL(ch))
strip_mortal_color( argument, TRUE );
in ACT_INFO.C I changed title to this
void do_title (CHAR_DATA * ch, char *argument)
{
if (IS_NPC (ch))
return;
if (argument[0] == '\0') {
send_to_char ("{RChange your title to what?{x\n\r", ch);
return;
}
if (strlen (argument) > 45)
argument[45] = '\0';
/* not even imms can use these here */
strip_mortal_color( argument, TRUE );
smash_tilde (argument);
set_title (ch, argument);
send_to_char ("{GTitle changed.{x\n\r", ch);
}
Notice not even immortals can use these in titles.
in do_say i added
if(!IS_IMMORTAL(ch))
strip_mortal_color( argument, FALSE );