Ah! Your maze object! You've encountered a wonderful feature of javascript that bit me a long time ago. Javascript objects can't be saved and restored properly if they contain methods. To work around it I declared the object just containing all the data and properties, and put all the methods in the global javascript. The object (data) can be saved and restored using the scriptVars.get and scriptVars.put, but your functions (methods) have to get and put the data before working on it. It's a pain, but that's the wonders of programming.desertfox wrote:Welp, bad news on being able to pick up where we left off. It seems the script engine wants to move forward one more command every time you come up, probably due to being primed to go there after you submit, but really more killer is that the maze object I made doesn't seem to serialize properly when I restart guideme, it comes in with some sort of error or null when it tries to get it out of the scriptvars. It could be something else going on but seems like that.
The maze object was set up likeWhich I don't know if that matters, might be over my head on this one. Which probably means it's going to have to be in one sitting.Code: Select all
function maze() { this.var = whatever; this.member_function = function() { do_stuff } }
Maybe in the future can try to restructure it in some other way to fix that, but not sure how to do so.
Clearly the best solution here is to run guideme in a VM and save the state of it when you are done ;)
You'll see the functions of the Script Engine getting and putting the ScriptData object all the time. That's exactly why. I couldn't code the functions into the object which would have been like proper object oriented programming.
As for the script engine advancing by one, I don't recall ever testing that. I'm sure we can sort that out, and in fact I'll probably need to for my own projects.
PG



