execute mprog if text.triggered?(mprog)
ch.print(text)
ch.print text
execute mprog if text.triggers?(mprog)
void mprog_act_trigger(char *buf, CHAR_DATA *mob, CHAR_DATA *ch, OBJ_DATA *obj, void *vo) {
if ( !mob || IS_PC( mob ) || !(mob->pIndexData->progtypes & ACT_PROG))
return;
MPROG_ACT_LIST * tmp_act = malloc(sizeof(MPROG_ACT_LIST));
tmp_act->next = mob->mpact;
tmp_act->buf = str_dup(buf);
tmp_act->ch = ch;
tmp_act->obj = obj;
tmp_act->vo = vo;
mob->mpact = tmp_act;
}
for (ch = char_list;ch ;ch = ch->next) {
/* MOBProgram ACT_PROG trigger */
if ( IS_PC( ch ) || !ch->mpact || !ch->valid)
continue;
MPROG_ACT_LIST * tmp_act, *tmp_act_next;
for (tmp_act = ch->mpact;tmp_act && ch->valid;tmp_act = tmp_act_next) {
tmp_act_next = tmp_act->next;
mprog_wordlist_check(tmp_act->buf, ch, tmp_act->ch, tmp_act->obj, tmp_act->vo, ACT_PROG );
free_string( &tmp_act->buf);
free(tmp_act);
}
/* Zap the pointer to the memory */
ch->mpact = NULL;
} /* mprog loop */
Basically, when you trigger something with the act trigger on a mobprog, the program is executing before the messaging is sent.
For example, if I have 'act nod' as the program trigger with a mob echo of "Testing", it would look like:
Testing
You nod.
This is the same for oprogs and rprogs as well. Here is my act_new function, any suggestions would be greatly appreciated.