This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
cmckain14's profile picture

Code Being Skipped

Started by cmckain14, 15 September 2013 - 01:48 PM
cmckain14 #1
Posted 15 September 2013 - 03:48 PM
I have been building a turtle farming program and an api to go with it but everytime I run the code, it misses a go down function which screws up the whole thing.
Program:http://pastebin.com/NY8skHUa
API:http://pastebin.com/h4teLJDJ
Symmetryc #2
Posted 15 September 2013 - 09:45 PM
Could you describe the problem you are experiencing in a bit more detail please?
campicus #3
Posted 15 September 2013 - 10:17 PM
I am not sure why that would skip. Replace "turtle.down()" with:


repeat
	term.setCursorPos(1,1)
	print("Something is blocking my way!")
	sleep(1)
	term.clear()
until turtle.down()

EDIT: You could probably use a for loop instead of your repeat loop as well, e.g.,


for x = 1,2 do
    <your code>
end
cmckain14 #4
Posted 15 September 2013 - 10:43 PM
Could you describe the problem you are experiencing in a bit more detail please?
What it is doing is when it is suppose to go down it just goes of forward like something it blocking its path but nothing is in front of it.
cmckain14 #5
Posted 15 September 2013 - 10:52 PM
It works perfectly now, thanks for all the help! I had miscounted the number of times it had to plant.