Jump to content




Should Be Yeilding Plenty , But Still Complains


6 replies to this topic

#1 etopsirhc

  • Members
  • 122 posts

Posted 23 January 2013 - 07:18 PM

ok so i've got this program that reads from a massive file and places a block as the coords ( line seporated ) every 50 times though the main loop the program sleeps for 5 seconds . it also uses an api / metatable i made to go to the positions as well as every 100 moves it will stop and take 5 again. so how am i supposed to fix this?

build: http://pastebin.com/7775XCcd
move: http://pastebin.com/phvtGG88

incase you want to test it with the file used in the build
https://dl.dropbox.c...ragnarok.coords

#2 Doyle3694

  • Members
  • 815 posts

Posted 23 January 2013 - 09:14 PM

make all os.sleep() sleep(), and check if the same problem still exists.

Why does people even use term.write(), os.sleep(), and io.read()?

#3 LBPHacker

  • Members
  • 766 posts
  • LocationBudapest, Hungary

Posted 23 January 2013 - 09:21 PM

First of all:

function writeLine()
  lw = fs.open("line.presist","w")
  lw.write(lineNum)
  lw.flush()
  lw.close()
end

"attempt to index ? (a nil value)" ? That's because lw does not have a .flush method. (This is not io, this is fs.)


And use the "local" keyword sometimes - It's not in Lua for decoration.

#4 ChunLing

  • Members
  • 2,027 posts

Posted 23 January 2013 - 10:44 PM

Where did you put the move API? If you have it loaded in your rom/apis folder, then it's probably being loaded before the turtle API loads. This causes your move API to use the java versions of the turtle functions, which do not yield.

Nearly all turtle functions (except the getters, which return instantly) are supposed to yield.

#5 etopsirhc

  • Members
  • 122 posts

Posted 23 January 2013 - 11:07 PM

@ chung
its in the root directory right next to the build program.

@LPB
i would if i ever planned on distributing as a finished product , but as is its just a tool for me to use :P

@doyle
ok , changed that and am testing it now. as i'm gonna crash soon i'll let that run over night and see how far it got

#6 ChunLing

  • Members
  • 2,027 posts

Posted 24 January 2013 - 08:50 AM

Okay, is the turtle moving about and placing prior to stopping for failure to yield? Or is it just sitting there, not moving or turning or placing or doing anything visible (outside the console) for the twenty seconds prior to being stopped?

#7 etopsirhc

  • Members
  • 122 posts

Posted 24 January 2013 - 10:22 AM

well so far no hang ups with the newest version
but even after removing the flush statement i cant get the writeLine() to work XP

added a clause to attack a mob if its in the way , and a shorter limit to start a break. between the 2 it seems fixed





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users