Beep Command

Original author: Altrag <altrag@realms.game.org>
Enhancements by Samson
Ported to SmaugWiz by Zanthoris

Installation Instructions
-------------------------

1. In act_comm.cpp, add the following code:

/* Installed by Samson on unknown date, allows user to beep other users */
/* Ported to SmaugWiz by Zanthoris on 11/08/2000 */

void do_beep(CCharacter *ch, char *argument) 
{
    char arg[MAX_INPUT_LENGTH];
    CCharacter *victim;
 
    argument = one_argument(argument, arg);

    if(!*arg || !(victim = get_char_world(ch, arg)))
    {
	 ch->SendText("Beep who?\n\r"); return;
    }
    /* NPC check added by Samson 2-15-98 */

    if(ch->IsNpc ())
    {
	 ch->SendText( "Beep who?\n\r"); return;
    }

    /* PCFLAG_NOBEEP check added by Samson 2-15-98 */
    if(victim->IsNoBeep ())
    {
      ch->SendTextf("%s cannot be beeped at this time.\n\r", victim->GetName());
	  return;
    }

    victim->SendTextf("%s is beeping you!\a\n\r", ch->GetName());
    ch->SendTextf("You beep %s.\n\r", victim->GetName());
    return;
}

2. In smaug.h, look for the following line:

   #define PCFLAG_NOTITLE     BV10

   after the above line add the following line:
   
   #define PCFLAG_NOBEEP      BV11   /* Added by Samson 2-15-98 */

   (Note: If you have modified your source you may need to use a higher number,
    just choose the next available one, BV12, BV13, etc. and add the above to
    the end of the PCFLAG section)

   also in smaug.h look for the following line:
   
   DECLARE_DO_FUN(do_bashdoor);

   after the above line add the following line:

   DECLARE_DO_FUN(do_beep);

3. In act_info.cpp, find the following in do_config:

	ch->SendText (ch->IsNoSummon ()
	  ? "[+NOSUMMON ] You do not allow other players to summon you.\n\r"
	  : "[-nosummon ] You allow other players to summon you.\n\r");
													// ? "[+NOSUMMON ] You do not allow other players to summon you.\n\r"
   and below it add:										// : "[-nosummon ] You allow other players to summon you.\n\r");

	ch->SendText (ch->IsNoBeep ()
	  ? "[+NOBEEP ] Beep is disabled.\n\r"
	  : "[-nobeep ] Beep is enabled.\n\r");
													// : "[-nobeep ] Beep is enabled.\n\r");
4. Also in act_info.cpp, do_config, find the following:

    else if ( !str_prefix( arg+1, "pager"    ) ) bit = PCFLAG_PAGERON;	

    and below it add:

    else if ( !str_prefix( arg+1, "nobeep" ) ) bit = PCFLAG_NOBEEP;

5. In skills.cpp find the following line:

	if (skill == do_bashdoor)		return "do_bashdoor";

   below this line add the following:

      if (skill == do_beep)			return "do_beep";

   also in skills.cpp find this line:

	if (!str_cmp (name, "do_bashdoor"))		return do_bashdoor;

   and add this one below it:

	if (!str_cmp (name, "do_beep"))			return do_beep;

6. In character.h look for:
	BOOL		IsNoSummon () { return (m_flags & PCFLAG_NOSUMMON) != 0; }
   Below this line add:	
	BOOL		IsNoBeep () {return (m_flags & PCFLAG_NOBEEP) != 0; }
   Then find this line:	
	BOOL		IsNoSummon ()
				{ return m_pPcdata ? m_pPcdata->IsNoSummon () : TRUE; }
   Below it add this:
	BOOL		IsNoBeep ()
				{ return m_pPcdata ? m_pPcdata->IsNoBeep () : TRUE; }

7. Make clean, then recompile.

8. Create a beep command, setting it to the desired level or just put the following
in your commands.dat file:
	
#COMMAND
Name        beep~
Code        do_beep
Position    0
Level       2
Log         0
End

9. Add the included help text to help.are (see below).

Suggested helpfile entry:

2 BEEP~
Syntax: beep <player>
 
BEEP sends a short sound blip to the other user's terminal to get their
attention. If someone doesn't respond right away, please don't keep
spamming them with beeps. Try back again later, they may have gone afk.
~

*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

This snippet was written for and tested on SmaugWiz version 2.01, I cannot guarantee that
it will work in previous versions without some modification (though I expect it will).  If
you have problems with this snippet let me know!

-=Zanthoris=-

zanthoris@hotmail.com
telnet:\\zanthoris.dhs.org:4000
http:\\zanthoris.home.dhs.org