191 posts
Posted 27 May 2013 - 01:29 PM
i have made a mining turtle. its worked fine for a couple of days now but now i got the error : "*see title*"
Note that i call the function many times and it doesnt break dorecly
seems to have got stuck on the following function
function save()
s = fs.open("coords","w")
s.writeLine(size) <--- here is where it breaks
s.writeLine(depth)
s.writeLine(x)
s.writeLine(y)
s.writeLine(z)
s.writeLine(facing)
s.close()
end
googled and it might be lag? Confirm? Way around it?
1190 posts
Location
RHIT
Posted 27 May 2013 - 01:39 PM
That's weird. Your code works perfectly fine for me and should not be forcing a "too long without yielding" error. Can you provide the full code on pastebin so that we can check the rest for errors as well (it is unlikely that this particular issue would originate elsewhere, but still possible).
By chance are you playing on a server with modified ROMs or using a startup program that might change the behavior of opening files?
191 posts
Posted 27 May 2013 - 04:03 PM
Pastebin:
http://pastebin.com/6w6unec9Im playing a singleplayer world through the launcher, might have modified the rem through there though
1522 posts
Location
The Netherlands
Posted 28 May 2013 - 02:15 AM
Its very easy to fix, in theory.
In your while loop, you do this:
while var % 2 == 0 do
--something
var = read()
end
Make that var into this:
var = tonumber(read())
this should work because var is not a string anymore
191 posts
Posted 28 May 2013 - 10:08 AM
In what while loop? i have a lot of them
197 posts
Location
Finland
Posted 28 May 2013 - 01:47 PM
Try adding sleep() somewhere
191 posts
Posted 28 May 2013 - 02:03 PM
I dont think a sleep will work, nor do i want to slow my turtle
197 posts
Location
Finland
Posted 28 May 2013 - 02:04 PM
I dont think a sleep will work, nor do i want to slow my turtle
I got the error, and i added sleep(0.2)
worked
is there other ways?
191 posts
Posted 28 May 2013 - 02:13 PM
Yeah but if i put 0.2 sleep its gonna be 0.2 seconds slower EVERY SINGLE BLOCK it mines
191 posts
Posted 28 May 2013 - 02:21 PM
I dont think a sleep will work, nor do i want to slow my turtle
I got the error, and i added sleep(0.2)
worked
is there other ways?
I dont wanna slow my turtle..D; i call that function after every block mined
1522 posts
Location
The Netherlands
Posted 28 May 2013 - 02:25 PM
use:
os.queueEvent("test")
coroutine.yield()
This yields and is quicker than sleep(0)
191 posts
Posted 28 May 2013 - 02:30 PM
use:
os.queueEvent("test")
coroutine.yield()
This yields and is quicker than sleep(0)
In the save function? ill try
Edit: seems to work, ill be back for updates
Worked fine for a couple of days, officialy solved