How To Call It
PhaseGate is a singleton global table: call its functions with a dot (PhaseGate.<method>(...)). Requires Macro Handler 1.0.51 or later.
The Time/Repeat gate: on each visit it picks the true or the false phase by visit count or elapsed time and keeps its state for the macro run.
Documented for app version 1.0.64Updated:
PhaseGate is a singleton global table: call its functions with a dot (PhaseGate.<method>(...)). Requires Macro Handler 1.0.51 or later.
Core flow APIs are usually the backbone of larger scenarios; keep them anchored to clear checkpoints and readable variables.
PhaseGate offers 4 methods; each method page lists its parameters and return value.
Using this API with logging, error handling, and next-step control produces much more professional results than calling it in isolation.
The snippet below is a starter pattern that can be applied directly in runtime flow.
local gate = PhaseGate.create({ trueMode = "count", trueLimit = 3, falseMode = "count", falseLimit = 1 })
if PhaseGate.next(gate) then
print("work phase")
endFrom foundation to combined usage, each level is provided as a separate code block so you can copy the level you need and adapt it directly.
local gate = PhaseGate.create({ trueMode = "count", trueLimit = 3, falseMode = "count", falseLimit = 1 })
if PhaseGate.next(gate) then
print("work phase")
endlocal gate = PhaseGate.create({ trueMode = "count", trueLimit = 3, falseMode = "count", falseLimit = 1 })
if PhaseGate.next(gate) then
print("work phase")
end
-- Continue with one focused method on the object.local gate = PhaseGate.create({ trueMode = "count", trueLimit = 3, falseMode = "count", falseLimit = 1 })
if PhaseGate.next(gate) then
print("work phase")
end
local note = "PhaseGate overview loaded"
print(note)-- Core flow APIs are usually the backbone of larger scenarios; keep them anchored to clear checkpoints and readable variables.
local function run_phasegate_step()
local gate = PhaseGate.create({ trueMode = "count", trueLimit = 3, falseMode = "count", falseLimit = 1 })
if PhaseGate.next(gate) then
print("work phase")
end
end
local ok, err = pcall(run_phasegate_step)
if not ok then
toast("Step failed")
print(err)
endlocal gate = PhaseGate.create({ trueMode = "count", trueLimit = 3, falseMode = "count", falseLimit = 1 })
if PhaseGate.next(gate) then
print("work phase")
end
wait(200)
print("Combined with logging and flow control")