sayto.txt
snippets · 2.5 KB · 2010-03-30
Sayto (simple): lets players target their says.
Download « Back to the snippets list
This is a very and I do mean very simple snippet written to allow players to target their
says, adds a very nice flavor to them and helps avoid complete confusion during heavy RPing
in crowded places.
It is the first snippet I've written, plus my first attempt at one and I dare say I am quite
pleased with the result. In any case, be so kind as to add a line for credit, simple or not
it is my firstborn. :P
It has been tested on a ROM codebase derivative, it works nicely, feel free to modify to
suit your tastes.
Enjoy
===========================================================================================
In interp.h after
DECLARE_DO_FUN (do_say);
add
DECLARE_DO_FUN (do_sayto);
===========================================================================================
In interp.c after
{"say", do_say, POS_RESTING, 0, LOG_NORMAL, 1},
{"'", do_say, POS_RESTING, 0, LOG_NORMAL, 0},
add
{"sayto", do_sayto, POS_RESTING, 0, LOG_NORMAL, 1},
===========================================================================================
Copy the following code after do_say in act_comm.c
CH_CMD (do_sayto)
{
char arg[MAX_INPUT_LENGTH];/*, buf[MAX_STRING_LENGTH]*/
CHAR_DATA *victim;
argument = one_argument (argument, arg);
if (arg[0] == '\0' || argument[0] == '\0')
{
chsend ("Say what to whom?\n\r", ch);
return;
}
if ((victim = get_char_world (ch, arg)) == NULL ||
victim->in_room != ch->in_room )
{
chsend ("They are not here.\n\r",ch);
return;
}
else
{
act ("" CTAG (_SAY1) "You say to $N '" CTAG (_SAY2) "$t"
CTAG (_SAY1) "'{x", ch, argument, victim, TO_CHAR);
act_new ("" CTAG (_SAY1) "$n says to you '" CTAG (_SAY2) "$t"
CTAG (_SAY1) "'{x", ch, argument, victim, TO_VICT, POS_DEAD);
act_new ("" CTAG (_SAY1) "$n says to $N '" CTAG (_SAY2) "$t"
CTAG (_SAY1) "'{x", ch, argument, victim, TO_ROOM, POS_DEAD);
}
if (!IS_NPC (ch))
{
CHAR_DATA *mob, *mob_next;
for (mob = ch->in_room->people; mob != NULL; mob = mob_next)
{
mob_next = mob->next_in_room;
if (IS_NPC (mob) && HAS_TRIGGER (mob, TRIG_SPEECH) &&
mob->position == mob->pIndexData->default_pos)
mp_act_trigger (argument, mob, ch, NULL, NULL,
TRIG_SPEECH);
}
}
return;
}
===========================================================================================
Made for GrMuD v 1.0 (c) 2002-2003 Khashnak
email: Elyandil@hotmail.com