/* Beep command adapted from Altrag's snippet for smaug. This will work on
* most codebases with minor tweaks but was designed with LoW4 in mind.
* No emails or help file additions or anything are needed for this. All
* I ask is that you release any snippets of your own work that you might
* have just laying around. Feel free to delete any comments in the code.
*
* -Igabod-
*/
/* Instructions for installing this snippet
*
* In merc.h under the ACT bits used for mobs at the bottom of that list
* add in the following, replacing the number with the first free bit.
*/
#define ACT_NOBEEP 262144
/* Somewhere among the DECLARE_DO_FUN's add in the following lines.
*/
DECLARE_DO_FUN( do_beep );
DECLARE_DO_FUN( do_nobeep );
/* In interp.c I've added a new section for new commands I made but if
* you don't wanna do that then just put this somewhere near the bottom
* of the cmd_table.
*/
{"beep", do_beep, POS_STANDING, 1, LOG_NORMAL },
{"nobeep", do_nobeep, POS_STANDING, 1, LOG_NORMAL },
/* Copy and paste the following two functions into any file you want.
* I made a file called iggystuff.c for all my random new commands but
* this can go in any file that has #include merc.h at the top.
*/
void do_beep(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *victim;
char buf[MAX_STRING_LENGTH];
if(!argument || !(victim = get_char_world(ch,argument)))
{
stc("{cBeep who?{x\r\n",ch);
return;
}
if (IS_NPC(victim))
{
stc("{cYou can only beep players.{x\r\n",ch);
return;
}
if (IS_SET(victim->act,ACT_NOBEEP))
{
sprintf(buf,"{C%s {cis not accepting beeps at this time.{x\r\n",victim->name);
stc(buf,ch);
return;
}
/* If you change the message here, be sure to leave the \a in since it
* is what causes the audible beep.
*/
sprintf(buf,"{C%s {cis beeping you!{x\a\r\n",PERS(ch,victim));
stc(buf,victim);
sprintf(buf,"{cYou beep {C%s.{x\r\n",PERS(victim,ch));
stc(buf,ch);
return;
}
void do_nobeep(CHAR_DATA * ch,char *argument)
{
if (IS_NPC(ch)) return;
if (IS_SET(ch->act,ACT_NOBEEP))
{
REMOVE_BIT(ch->act,ACT_NOBEEP);
stc("You can now be the target of beeps.\r\n",ch);
return;
}
else if (!IS_SET(ch->act,ACT_NOBEEP))
{
SET_BIT(ch->act,ACT_NOBEEP);
stc("You can no longer be the target of beeps.\r\n",ch);
return;
}
else
{
stc("Excuse you?\r\n",ch);
return;
}
return;
}
/* Do a clean compile and then copyover and you should be good to go.
* You will want to read through the functions and make changes to the
* colors and possibly the messages.
*
* If you have difficulty installing this snippet, go to www.mudbytes.net
* or www.godwars.net and ask for help on the forums there. Both places
* are full of people who can and will help you.
*/