for num=1,5 do
turtle.select(1)
turtle.place()
turtle.select(2)
sleep(5)
end
turtle.compare() do
turtle.dig()
turtle.forward()
end
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while turtle.detectDown()==false do
turtle.down()
end
turtle.back()
turtle.select(3)
turtle.dropDown()
end
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
eof error in tree harvester program
Started by bedved, 31 July 2013 - 06:49 PMPosted 31 July 2013 - 08:49 PM
Hello, I have been working on simply one tree logger, but I get (eof) error all the time. I googled it and did check all things what I could imagine about it, but did not find the answer what I was looking for. Could anyone tell me, what is wrong with this?
Posted 01 August 2013 - 12:36 AM
Split into new topic.
Posted 01 August 2013 - 12:38 AM
You have two too many ends.
Posted 01 August 2013 - 12:40 AM
Just one too many, actually.
Posted 01 August 2013 - 01:21 AM
You can easily tell how many 'end's you need if you properly format your code. Saves me lots of time :)/>
Posted 01 August 2013 - 05:40 AM
The use of Notepad ++ would help you alot in this. And always indent your code by using tab.
Posted 01 August 2013 - 08:32 AM
i think (s)he is missing 'for' on line 7
Posted 01 August 2013 - 09:04 AM
i think (s)he is missing 'for' on line 7
Plus (s)he missed to compare a block to a specific slot in the inventory. Or is that not necessary with turtle.compare()?
Posted 01 August 2013 - 09:37 AM
Plus (s)he missed to compare a block to a specific slot in the inventory. Or is that not necessary with turtle.compare()?
the turtle default inventory slot that is selected is the top left one (aka. number 1)
Posted 08 August 2013 - 07:08 PM
Hi there i have recently downloaded CC and have watched and read many tutorials and thought i would give a shot at making my own automated tree farm. This was all going good until i have reached the point w tree here i just dont know whats wrong.
Basicly there is no errors, it plants the saplings and then sleeps and checks to see if they have grown. The problem is that when the turtle chops down the tree it doesnt come back down. Its like it just ignores that part of the code for some reason any help would be appreciated.
I have highlighted the part in red for you.
– How many trees to plant
print("Please put dirt in slot 1, saplings in slot 2 and logs in slot 3.\n")
print("How many trees do you want planted?")
local info = io.read()
local dirt, sapling, log = 1, 2, 3
– Planting first set of trees
for i = 1,info do
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.digDown()
turtle.select(dirt)
turtle.placeDown()
turtle.select(sapling)
turtle.back()
turtle.place()
turtle.turnLeft()
end
– Moving to position
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
– Check to see if trees are grown
while true do
os.sleep(10)
for i = 1, info do
turtle.select(log)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
– If tree is grown
if turtle.compare() then
turtle.dig()
turtle.forward()
while turtle.detectUp() do
print("Digging up")
turtle.digUp()
turtle.up()
end
while not turtle.detectDown do
print("Going down")
turtle.down()
end
turtle.back()
turtle.select(sapling)
turtle.place()
end
turtle.turnLeft()
end
– Round the corner
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
end
Basicly there is no errors, it plants the saplings and then sleeps and checks to see if they have grown. The problem is that when the turtle chops down the tree it doesnt come back down. Its like it just ignores that part of the code for some reason any help would be appreciated.
I have highlighted the part in red for you.
– How many trees to plant
print("Please put dirt in slot 1, saplings in slot 2 and logs in slot 3.\n")
print("How many trees do you want planted?")
local info = io.read()
local dirt, sapling, log = 1, 2, 3
– Planting first set of trees
for i = 1,info do
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.digDown()
turtle.select(dirt)
turtle.placeDown()
turtle.select(sapling)
turtle.back()
turtle.place()
turtle.turnLeft()
end
– Moving to position
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
– Check to see if trees are grown
while true do
os.sleep(10)
for i = 1, info do
turtle.select(log)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
– If tree is grown
if turtle.compare() then
turtle.dig()
turtle.forward()
while turtle.detectUp() do
print("Digging up")
turtle.digUp()
turtle.up()
end
while not turtle.detectDown do
print("Going down")
turtle.down()
end
turtle.back()
turtle.select(sapling)
turtle.place()
end
turtle.turnLeft()
end
– Round the corner
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
end
Posted 08 August 2013 - 07:15 PM
Here I Think This Should Work But I Didn't Test It Because I Was To Lazy
for num=1,5 do
turtle.select(1)
turtle.place()
turtle.select(2)
sleep(5)
end
while turtle.compare() do
turtle.dig()
turtle.forward()
end
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while turtle.detectDown()==false do
turtle.down()
end
turtle.back()
turtle.select(3)
turtle.dropDown()