--- Bradley Hegel <[EMAIL PROTECTED]> wrote:
> 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.


Looks good, though I would probably have done it like:


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

        char *wrapper;
        char buf[MSL];
        char speak_verb[10];
        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);

        switch(string[length-1])
        {
                case '!':
                        strcpy(speak_verb, "exclaim"); break;
                case '?':
                        strcpy(speak_verb, "ask");     break;
                default:
                        strcpy(speak_verb, "state");   break;
                        
        }

        sprintf(buf,"$n %ss: '%s{x'",wrapper, speak_verb);
        act( buf, ch, NULL, argument, TO_ROOM );
        printf_to_char(ch,"You %s: '%s{x'\n\t", wrapper, speak_verb);

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

=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$ 
P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O 
M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@ 
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Reply via email to