Oh, there's one other thing I should note that's probably making us talk past one another somewhat: Lil in Decker is deliberately capped at a specific number of "ops" (VM bytecode steps) per "frame" (display updates at 60fps) . This is an arbitrary creative constraint intended to help decks behave more consistently across different machines with wildly different levels of performance. The "FRAME_QUOTA" constant in the JavaScript implementation controls this cutoff.
Is there an API to check “fraction of script steps remaining this frame” from inside a Lil script? (For operations with shorter limits, like accessing a property on a Contraption, is there one that checks the operation limit?)
I’m consider9ing Decker to write a loosely-chess-inspired roguelike, and I’d want to use this to know when to stop searching for a move on the current frame and advance a “thinking” animation so the deck does not act frozen during the opponent’s turn.
There is not presently a way to inspect the remaining per-frame quota (or other limits) from within executing scripts.
As a developer you can get a rough idea of how close your scripts are to quota by enabling the "Script Profiler" feature from within the Decker menu. This will display a live chart of the percentage of quota scripts have consumed over the past few seconds.
If you want to provide the user with visual feedback during long-running scripts, you need only draw visible updates from time to time. When a script runs out of quota it is simply paused momentarily to allow Decker to service input and then automatically resumed, unless the user explicitly halts it.