29 posts
Location
Kansas
Posted 22 October 2012 - 01:41 AM
My idea is concerning computercraft computers remembering what line of what program it was running when, for example, you save and quit to title, and then when you start up again it continues where it left off.
I think it might be possible to make it write a short .txt in the computer folder in the world folder that contains this information then when you start up again it it checks for this file then if there is none then it just runs startup like it does now and if there is the file then it reads it and runs the program at the specified line.
cross post from Dan200's reddit post
2217 posts
Location
3232235883
Posted 22 October 2012 - 02:02 AM
you can just just make a program to save the currently running program
1548 posts
Location
That dark shadow under your bed...
Posted 22 October 2012 - 05:37 AM
I think they plan on saving the java code of the running computer. that way you don't have to save anything else. it will seamlessly resume without even being aware that it stopped
2005 posts
Posted 22 October 2012 - 05:46 AM
They do plan on adding that feature…I wasn't aware that saving the java code was necessary, though…they just need to save the lua variables and execution status. I mean…we can't change the java anyway, can we?
1548 posts
Location
That dark shadow under your bed...
Posted 22 October 2012 - 06:16 AM
yea but you see that will cause issues if you are half way through executing a function like turtle.forward(). it will resume waiting for the turtle_response event but never get it. saving the java engine ensures that it will resume without error (well I can't guarantee that but we have good DEVs, they will sort it out :)/>/> )
2005 posts
Posted 22 October 2012 - 08:49 AM
Ah…I remember when leaves would kill my turtles if they were moving when the leaves grew. We've come a long way.
2447 posts
Posted 22 October 2012 - 08:50 AM
We won't save the java code - but turtles already save what action they are doing - if you make a turtle go forward and quickly exit it will continue - then stop.
1548 posts
Location
That dark shadow under your bed...
Posted 22 October 2012 - 11:46 AM
but if you exit MC and re-open it then it will resume the code exactly where it was. if you have just started sleep(5) then it queued an event before you killed it, will that event still occur or will it keep waiting for it?
2447 posts
Posted 22 October 2012 - 12:57 PM
but if you exit MC and re-open it then it will resume the code exactly where it was. if you have just started sleep(5) then it queued an event before you killed it, will that event still occur or will it keep waiting for it?
We will obviously save anything needed when resuming - any timers, turtle moves etc - but we don't have to save java code state.
2005 posts
Posted 22 October 2012 - 08:09 PM
Well, that's good then. It's nice to know this feature is moving ahead without too many obstructions.
29 posts
Location
Kansas
Posted 22 October 2012 - 10:08 PM
thanks for the answer
it is good to know that this is being worked on
2217 posts
Location
3232235883
Posted 31 October 2012 - 05:42 PM
im working on an advanced serialization program that can convert the entire _G table and all the functions and function environments :3 :3 :3
autosave anyone?
2005 posts
Posted 31 October 2012 - 10:46 PM
Yikes! How close are you?
724 posts
Posted 02 November 2012 - 03:11 AM
How would you serialize functions with global names in it? Seems no way.
1548 posts
Location
That dark shadow under your bed...
Posted 02 November 2012 - 03:26 AM
you can dump most functions to a string and load them again but there are some functions that aren't all Lua and it errors when you try to save them