function QueuedTriggerAddBJ takes trigger trig, boolean checkConditions returns boolean
// Make sure our queue isn't full. If it is, return failure.
if (bj_queuedExecTotal >= bj_MAX_QUEUED_TRIGGERS) then
return false
endif
// Add the trigger to an array of to-be-executed triggers.
set bj_queuedExecTriggers[bj_queuedExecTotal] = trig
set bj_queuedExecUseConds[bj_queuedExecTotal] = checkConditions
set bj_queuedExecTotal = bj_queuedExecTotal + 1
// If this is the only trigger in the queue, run it.
if (bj_queuedExecTotal == 1) then
call QueuedTriggerAttemptExec()
endif
return true
endfunction