View Single Post
Old 07-11-2002, 10:38 PM   #2
erdos
 
Posts: n/a
In order to make speech triggers trigger items in a char's inventory, you need to adjust the "oprog_speech_trigger" function in mud_prog.c.  You'll notice that this small function loops through the items on the floor.  So just add 1 or 2 loops to loop through the items in the person's inventory (and, optionally, to loop through the inventories of other people in the room).  So if you want it to loop through everyone's inventories, the new oprog_speech_trigger will look like this:

void oprog_speech_trigger( char *txt, CHAR_DATA *ch )
{
   OBJ_DATA *vobj;
   CHAR_DATA *vchar;

   /* supermob is set and released in oprog_wordlist_check */
   for ( vobj=ch->in_room->first_content; vobj; vobj = vobj->next_content )
if ( HAS_PROG(vobj->pIndexData, SPEECH_PROG) )
   oprog_wordlist_check(txt, supermob, ch, vobj, NULL, SPEECH_PROG, vobj);

   for ( vchar = ch->in_room->first_person; vchar; vchar = vchar->next_in_room )
   for ( vobj = vchar->first_carrying; vobj; vobj = vobj->next_content )
   if ( HAS_PROG( vobj->pIndexData, SPEECH_PROG ) )
   oprog_wordlist_check( txt, supermob, ch, vobj, NULL, SPEECH_PROG, vobj );

return;
}
  Reply With Quote