Does anyone know if there is a way to exit early when a print command is running with the
\^d p8scii special command that adds delay frames in between each character?
I'm in token crunch mode and realizing this new special command could be extremely handy for easy RPG-style printing delay with zero code in certain situations, but if there was a way to exit early, it would be even more useful!
And if this is not currently possible, consider it a feature request :p
There's no way to do it, I'm near certain. It's a complete pause within the print() function call itself. You don't get more update() or draw() calls or anything during the pause, so there's no opportunity to execute logic, and PICO-8 is single threaded.
I suppose there's a joke answer involving the escape key, but that's not helpful. ;)
I'm curious what feature enhancement would be most useful, like a poke that affects the print() renderer behavior. Maybe a btn() value/mask that cancels the active pause, or increases its speed (reduces its value) to N? Seems a bit specific to the "RPG dialog" use case but it does feel like a primary use case for the feature. wdyt?
It would be possible with an extra argument in the command itself, but then making it flexible would be difficult. Basically, the underlying function call that it gets interpreted as would need to accept a value indicating that breaking out of the delay is allowed, then also some combination of 1. a bitmask for which buttons and optionally 2. a function to jump to. That's rather awkward for a shorthand of that sort.
Alternatively, a poke value could be used to give a bitmask for which buttons cancel the delay as ddaaannn said. However, if it were intended for dialogue, I think it would need to be able to cancel all the delays within a string of text then preferably also set a value that could be either peeked or retrieved from stat() to indicate that it had done so. That way any animations that are tied to that dialogue would know to skip too.
yeah the more I think about it the more awkward this hypothetical feature seems in terms of fitting in with the API...
I'm not sure how common it is to be so token constraned that even a simple loop is painful to fit in... perhaps my hope that such a feature might exist is more a symptom of the overly ambitious nature of the cart I happen to be working on right now, lol
[Please log in to post a comment]