Clearing the log when the user presses Crtl+R or Crtl+S, is only possible (as far as i know) if i would delete the log when "S" is pressed after "Ctrl", but it would be instant and i can't check wether "Ctrl" is still pressed…
But i could have pointed out, that "F1" clears the log :P
And this gives the user the opportunity to switch a pc off and still be able to restore it :)
Indeed, I can't really fault the behaviour - but I do feel it's worth documenting.
I don't see a way of saving/limiting disk size on my side without loosing data. Please tell me if you do :)
I guess this has to be the resposibility of the users.
Again I agree - just so long as it's made clear that they should do so.
Speaking of which, fs/io calls may also trip this script up - say a script reads data from a file, deletes that file, then writes a new one on exit. If the MineCraft server shuts down, then there's no way to resume that particular script correctly without recording what the file reads returned yourself. Such a level of recording may be going overboard, however.
"worm" is now resumed, because the restore algorithm now looks for an (only one max) unfinshed timer. But i does not restore the position and the score (i have no clue why yet).
While that's not the behaviour I get, it's certainly not working as expected, so I figured I'd take a bit of a dig into this - even read through the "worm" script (Messy! Declares a non-local function and all!) before figuring it out.
Line 46 returns "fakeTable[2]" instead of [1]. This means that during "playback" scripts may start waiting for timer events with an ID of "timerStart" (which'll never come).
However, fixing that still leaves the problem that if "playback" finishes and the recorded script is still waiting for a timer event to come back, then that event never gets queued and so it waits forever. If there were no timers hanging at the time of the shutdown it'll otherwise work correctly.
This script could
os.queueEvent() one for it, though you'll indeed need to keep track of how many timers are still supposed to be "running" when playback finishes to do it correctly. Perhaps keep tabs on
os.clock() in order to figure out when the "fake" timer event should be returned… On the other hand, if you're going to do that, there's no need to actually queue the event properly at all, I suppose.
Speaking of which, os.clock() and the other time-returning functions are others that should be overridden. Perhaps results from things like
peripheral.isPresent(), too. It's also missing a method of dealing with os.pullEventRaw()'s being used directly by recorded scripts, which is probably most important.