Posted 20 December 2014 - 08:17 PM
Note: I am using Tekkit Classic, so any fixes after ComputerCraft 1.33 do not help
Hello, I am having a bit of trouble trying to get a program to work. The program is supposed to go foward until it hits something, detect what the block is, and if it is a…
…tree - chop it down
…sapling - go over it
…stone - turn around
…sandstone - turn around and stop
Note: The server I am on is set so turtles do not need fuel
What it is doing is when it hits a sapling, occasionally it will just stop and scroll through the first 4 items, skipping the detect function completely. The only way I have found to fix it is by changing the block in front of it (breaking the sapling, growing the tree, etc.).
I really want to know how to fix this problem.
Hello, I am having a bit of trouble trying to get a program to work. The program is supposed to go foward until it hits something, detect what the block is, and if it is a…
…tree - chop it down
…sapling - go over it
…stone - turn around
…sandstone - turn around and stop
function chop() --Creates the function chop() for the wood chopping algorithm.
turtle.dig()
turtle.digUp()
turtle.up()
end
function over() --Creates the function over() for skipping that block.
turtle.up()
turtle.forward()
turtle.forward()
turtle.down()
end
function around() --Creates the function around() for turning around
turtle.turnLeft()
turtle.turnLeft()
end
function stop() -- Shortens the shutdown command to just "stop()"
os.shutdown()
end
while true do
while not turtle.detect() do --Goes forward until it reaches something in its path
turtle.forward()
end
turtle.select(1) --Selects Sapling
if turtle.compare() then
over()
end
turtle.select(2) --Selects Wood
if turtle.compare() then
while turtle.compare() do --Wood chopping algorithm.
chop()
end
while not turtle.detectDown() do --Goes down until it reaches the ground.
turtle.down()
end
turtle.select(1) --Selects and places sapling.
turtle.place()
over()
end
turtle.select(3) --Selects Stone
if turtle.compare() then
around()
end
turtle.select(4) --Selects Sandstone (Stopping Block)
if turtle.compare() then
around()
stop()
end
end
Note: The server I am on is set so turtles do not need fuel
What it is doing is when it hits a sapling, occasionally it will just stop and scroll through the first 4 items, skipping the detect function completely. The only way I have found to fix it is by changing the block in front of it (breaking the sapling, growing the tree, etc.).
I really want to know how to fix this problem.