SugarCube contain special tag bookmark but mostly this good for player navigation. And I can’t find what can work like the same, but only when called from background.
Can you add two function in “Engine API” for realization this?
Engine.mark() - boolean. Setup mark on called moment in history to return for marked passage.
Engine.return() - boolean. Return game on last marked moment in past history. If moment was dropped from history (by max state limit) only will be return false.
Both function names is example.
This will be cool for returned game state if player die, for returned from ingame manual (because that passages only contains helpful description and not affected on game) and similar situations.
I'm thought little more about that and has concluded system must be a little more complexity. Need additional functions "Engine.hasMark() - boolean.", to check to exist mark or not, and "Engine.markStep() - int", to get number of step where mark set. These functions can be used in a lot of ways, but paramount is need to control mark in history borders (if mark can exit from max history we must have a way to check this).
First function used to check on exist of mark, Second function to calculate how far we go from here and how many steps we can do it before mark has died (be better if calculation be created by developers, I think).
Honestly, the fifth function will not be a hindrance and can be in engine. "Engine.markLeft() - int", return number of left steps before mark has died.
And example of how I can use this.
Player must resolve some puzzle and have 10 or fewer steps to resolve him.
I set mark on a step with rules if after a 10 step puzzle still not resolved will be showed dialog window with losing message and game returned on mark, after closing a dialog. That saves a lot of resources (because will allow rewrite wrong progress) and do it game more interactive.
Original request (from the old Bitbucket repo):