specprocs are triggered from interpreter.c before the command is actually executed.
This means that the user needs to input something to trigger it.
I see two ways to get what you're doing to work - either switch to using a dg trigger (see examples in existing world files) or make certain types of specprocs fire when in battle.
If you look in interpreter.c (
github.com/tbamud/tbamud/blob/master/src/interpreter.c#L982
) you can see how the specials are called.
If you were to add something similar to fight.c (
github.com/tbamud/tbamud/blob/master/src/fight.c#L950
), you could trigger the spec_proc each round:
Code:
if (MOB_FLAGGED(ch, MOB_SPEC) && GET_MOB_SPEC(ch) && !MOB_FLAGGED(ch, MOB_NOTDEADYET)) {
char actbuf[MAX_INPUT_LENGTH] = "";
(GET_MOB_SPEC(ch)) (ch, ch, 0, actbuf);
} /* special in equipment list? */
+ for (j = 0; j < NUM_WEARS; j++) {
+ if (GET_EQ(ch, j) && GET_OBJ_SPEC(GET_EQ(ch, j)) != NULL && !MOB_FLAGGED(ch, MOB_NOTDEADYET)) {
+ char actbuf[MAX_INPUT_LENGTH] = "";
+ (GET_OBJ_SPEC(GET_EQ(ch, j))) (ch, GET_EQ(ch, j), NULL, actbuf)
+ }
+ }
}
Note that you'll have to do some sanity checking in your spec proc - are we still fighting? Are we in the same room as the target? Was there no "cmd" given (so we know this is triggered this way)?