Hey all,

    I recently made some changes to do_say to add a little more
functionallity to it.  I figured I'd send it to the list for others to use
and to get some feedback on it.  Not really sure if this was the best way to
this, but here it is.

void do_say( CHAR_DATA *ch, char *argument )
{

     char *wrapper;
     char buf[MSL];
     char *string;
     int length;


     string = argument;

        if ( argument[0] == '\0' )
        {
             send_to_char( "Say what?\n\r", ch );
             return;
        }

         wrapper = wrapstr(ch,argument);

        length = strlen(string);


        if(*(string+length-1) == '!')
         {
              sprintf(buf,"$n exclaims: '%s{x'",wrapper);
              act( buf, ch, NULL, argument, TO_ROOM );

          printf_to_char(ch,"You exclaim: '%s{x'\n\t",wrapper);
         }


          if(*(string+length-1) == '?')
         {
            sprintf(buf,"$n asks: '%s{x'",wrapper);
              act( buf, ch, NULL, argument, TO_ROOM );

          printf_to_char(ch,"You ask: '%s{x'\n\r",wrapper);
         }

        if(*(string+length-1) != '!' && *(string+length-1) != '?')
       {
          sprintf(buf,"$n states: '%s{x'",wrapper);
          act( buf, ch, NULL, argument, TO_ROOM );

          printf_to_char(ch,"You state: '%s{x'\n\r",wrapper);
      }

        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;
}

Well, let me know what ya think.

Krad

Owner/Imp  Sublingual Liason


Reply via email to