There are better ways to do the following, such as adding this as a
subcommand, but I had an idea of changing do tell and I didn't want to have
to mess with a beep command in there as well, so it is a totally set apart
from the do_tell. Also to keep do_tell as tight as possible. As stated
below, this is a hack of do_tell. I just wanted to share it with those on
the list who may have been looking for something like this. I know most of
the experienced coders will have no use for this code. Note I already sent
this to Ale to see if he might want it on the snippets site.
****************************************************************************
***
************************************************************
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.
---------------------------------
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST