Fix capture_audio_synth_header.py for headless --exec mode

Timers never fire in --headless --exec mode (the game loop runs but
does not process the timer queue without explicit step() calls).
Replace the Timer-based screenshot with a step() loop that advances
the engine 30 ticks at 10ms each before calling automation.screenshot().

This fix was discovered and applied as part of blog post 0033 publication
(Kanboard #209 / #345).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-04-18 23:25:17 -04:00
commit 17664ba741

View file

@ -8,9 +8,10 @@ demo_path = (pathlib.Path(__file__).resolve().parent.parent /
"tests" / "demo" / "audio_synth_demo.py") "tests" / "demo" / "audio_synth_demo.py")
runpy.run_path(str(demo_path), run_name="__demo__") runpy.run_path(str(demo_path), run_name="__demo__")
def shot(timer, runtime): # In headless --exec mode timers never fire; use step() to advance the loop.
for _ in range(30):
mcrfpy.step(0.01)
automation.screenshot(OUT) automation.screenshot(OUT)
print(f"Wrote {OUT}") print(f"Wrote {OUT}")
sys.exit(0) sys.exit(0)
mcrfpy.Timer("header_shot", shot, 150)