Beep Command [by Lord Kyu]
Snippet Posted Wednesday, August 12th @ 11:24:32 PM, by George Greer in the Commands dept.
Added Jul 6, 1998. Click the link below to read it or download it.

From: Lord Kyu <shapeshifter@tka.com>
Subject: Kyu's do_beep function

************************************************************

This is a hack of do_tell that I used to make a quick and simple little
beep command to get people's attention who may be away from their keyboard,
or in another window. Note, this is not a patch, though may be able to be
used as a drop code with some minor adjustments. Note, be sure to remove
anything that does not apply to your realm.

- Lord Kyu -
************************************************************
---------------------------------
Under ACMD(do_bash); n interpreter.c add:
---------------------------------
ACMD(do_beep);

---------------------------------
Under  { "bash"      , POS_FIGHTING, do_bash     , 1, 0 }, in interpreter.c
add:
---------------------------------
{ "beep"      , POS_DEAD    , do_beep     , 0, 0 },

---------------------------------
Under do_page in act.other.c add:
---------------------------------

void perform_beep(struct char_data *ch, struct char_data *vict)
{
  send_to_char(CCRED(vict, C_NRM), vict);
  sprintf(buf, "\007\007$n is beeping you!");
  act(buf, FALSE, ch, 0, vict, TO_VICT | TO_SLEEP);
  send_to_char(CCNRM(vict, C_NRM), vict);

  if (PRF_FLAGGED(ch, PRF_NOREPEAT))
    send_to_char(OK, ch);
  else {
    send_to_char(CCRED(ch, C_CMP), ch);
    sprintf(buf, "You beep $N.");
    act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
    send_to_char(CCNRM(ch, C_CMP), ch);
  }
}

ACMD(do_beep)
{
  struct char_data *vict;

  one_argument(argument, buf);

  if (!*buf)
    send_to_char("Beep who??\r\n", ch);
else if (ch == vict)
  send_to_char("\007\007You beep yourself!!\r\n", ch);
else if (!(vict = get_char_vis(ch, buf)))
    send_to_char(NOPERSON, ch);
  else if (PRF_FLAGGED(ch, PRF_NOTELL))
    send_to_char("You can't beep people while you have notell on.\r\n",
ch);
  else if (PRF_FLAGGED(ch, PRF_AFK))
    send_to_char("You can't beep someone if you are not at the
keyboard.\r\n", ch);
  else if (ROOM_FLAGGED(ch->in_room, ROOM_SOUNDPROOF))
    send_to_char("The walls seem to absorb your beeps.\r\n", ch);
  else if (!IS_NPC(vict) && !vict->desc)        /* linkless */
    act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR |
TO_SLEEP);
  else if (PLR_FLAGGED(vict, PLR_WRITING))
    act("$E's writing a message right now; try again later.",
        FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
  else
    perform_beep(ch, vict);

---------------------------------
And thats all there is to it.
---------------------------------



<< Autoloot and Autosplit Code [by Ron Hensley] | Reply | View as text | Flattened | Blood Left Behind [by Rasdan] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.