int greet_mtrigger(char_data *actor, int dir) { trig_data *t; char_data *ch; char buf[MAX_INPUT_LENGTH]; int rev_dir[] = { SOUTH, WEST, NORTH, EAST, DOWN, UP }; int intermediate, final=TRUE; for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) { if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) || !AWAKE(ch) || FIGHTING(ch) || (ch == actor) || AFF_FLAGGED(ch, AFF_CHARM)) continue; for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) { if (((IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET) && CAN_SEE(ch, actor)) || IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET_ALL)) && !GET_TRIG_DEPTH(t) && (number(1, 100) <= GET_TRIG_NARG(t))) { if (dir>=0) add_var(&GET_TRIG_VARS(t), "direction", dirs[rev_dir[dir]], 0); ADD_UID_VAR(buf, t, actor, "actor", 0); intermediate = script_driver(ch, t, MOB_TRIGGER, TRIG_NEW); if (!intermediate) final = FALSE; continue; } } } return final; }
int door_mtrigger(char_data *actor, int subcmd, int dir) { trig_data *t; char_data *ch; char buf[MAX_INPUT_LENGTH]; for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) { if (!SCRIPT_CHECK(ch, MTRIG_DOOR) || !AWAKE(ch) || FIGHTING(ch) || (ch == actor) || AFF_FLAGGED(ch, AFF_CHARM)) continue; for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) { if (IS_SET(GET_TRIG_TYPE(t), MTRIG_DOOR) && CAN_SEE(ch, actor) && !GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { add_var(&GET_TRIG_VARS(t), "cmd", cmd_door[subcmd], 0); if (dir >= 0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[dir], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); ADD_UID_VAR(buf, t, actor, "actor", 0); return script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW); } } } return 1; }
int greet_mtrigger(char_data *actor, int dir) { trig_data *t = NULL; char_data *ch = NULL; char buf[MAX_INPUT_LENGTH] = {'\0'}; int intermediate = 0, final = TRUE; if (!valid_dg_target(actor, DG_ALLOW_GODS)) return TRUE; for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) { if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) || !AWAKE(ch) || FIGHTING(ch) || (ch == actor) || AFF_FLAGGED(ch, AFF_CHARM)) continue; for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) { if (((IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET) && CAN_SEE(ch, actor)) || IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET_ALL)) && !GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) { if (dir >= 0 && dir < DIR_COUNT) add_var(&GET_TRIG_VARS(t), "direction", dirs[rev_dir[dir]], 0); else add_var(&GET_TRIG_VARS(t), "direction", "none", 0); ADD_UID_VAR(buf, t, actor, "actor", 0); intermediate = script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW); if (!intermediate) final = FALSE; continue; } } } return final; }
void greet_memory_mtrigger(char_data *actor) { trig_data *t; char_data *ch; struct script_memory *mem; char buf[MAX_INPUT_LENGTH]; int command_performed = 0; for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) { if (!SCRIPT_MEM(ch) || !AWAKE(ch) || FIGHTING(ch) || (ch == actor) || AFF_FLAGGED(ch, AFF_CHARM)) continue; /* find memory line with command only */ for (mem = SCRIPT_MEM(ch); mem && SCRIPT_MEM(ch); mem=mem->next) { if (GET_ID(actor)!=mem->id) continue; if (mem->cmd) { command_interpreter(ch, mem->cmd); /* no script */ command_performed = 1; break; } } /* if a command was not performed execute the memory script */ if (mem && !command_performed) { for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) { if (IS_SET(GET_TRIG_TYPE(t), MTRIG_MEMORY) && CAN_SEE(ch, actor) && !GET_TRIG_DEPTH(t) && number(1, 100) <= GET_TRIG_NARG(t)) { ADD_UID_VAR(buf, t, actor, "actor", 0); script_driver(ch, t, MOB_TRIGGER, TRIG_NEW); break; } } } /* delete the memory */ if (mem) { if (SCRIPT_MEM(ch)==mem) { SCRIPT_MEM(ch) = mem->next; } else { struct script_memory *prev; prev = SCRIPT_MEM(ch); while (prev->next != mem) prev = prev->next; prev->next = mem->next; } if (mem->cmd) free(mem->cmd); free(mem); } } }