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

[Question]Turtle disappears while cutting trees?[SOLVED]

Started by Ikkalyzte, 30 July 2012 - 07:10 PM
Ikkalyzte #1
Posted 30 July 2012 - 09:10 PM
Ok, so while I have my basic noob tree-farming turtle running, it seems that it will periodically disappear. Not run off, or drop any items, just simply *poof* into thin air.
I haven't actually seen this, but when I come back to check on it, sometimes it is just gone, and all the trees have grown. As far as I can tell, my code doesn't even put it in the way of any trees growing into it, and I am very confused. Any help is appreciated.

I've posted this same program a couple times before in this forum, but I will again, because it has some modifications:
Spoilerfunction anykey()
while true do
local keypress=os.pullEvent("key")
if keypress=="key" then
break
end
end
end

shell.run('clear')
textutils.slowPrint("Initialization in progress…")
sleep(5)
print("This Turtle is programmed for a fenced in, rectangular birch tree farm, with 2 spaces between each tree, and a one-block space around the whole farm.")
sleep(1)
print("I am supposed to be placed in the bottom-left corner of the farm. If this is not the case, please move me there and try again.")
print("Press any key to continue.")
anykey()
shell.run('clear')
print("Please fill the upper-left slot with saplings.")
print("When finished, press any key to continue.")
anykey()
shell.run('clear')
print("Auto-Measuring…")

–Auto-init:

local L=0 –length of farm
local W=0 –width of farm

–Measure length

while not turtle.detect() do
turtle.forward()
turtle.turnLeft()
if turtle.detect() then
L=L+1
else
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnRight()
break
end
turtle.turnRight()
turtle.forward()
if not turtle.detect() then
turtle.forward()
end
end
turtle.turnLeft()
turtle.turnLeft()

–Return to start

local x=3*L-1

for e=1,x do
turtle.forward()
end
turtle.turnRight()

–Measure width

while not turtle.detect() do
turtle.forward()
turtle.turnRight()
if turtle.detect() then
W=W+1
else
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnLeft()
end
turtle.turnLeft()
turtle.forward()
if not turtle.detect() then
turtle.forward()
end
end
turtle.turnRight()
turtle.turnRight()

–Return to start

local y=3*W-1

for f=1,y do
turtle.forward()
end
turtle.turnLeft()

print("Initialization complete! Beginning farming…")


–Actual Farming

local farmloop=true
turtle.select(1)

while(farmloop) do
turtle.up()
while turtle.getItemCount(1)>16 do
for a=1,W do
for b=1,L do
turtle.forward()
turtle.turnLeft()
if turtle.detect() then
turtle.dig()
turtle.forward()
turtle.digDown()
turtle.select(2)
while turtle.compareUp() do
turtle.digUp()
turtle.up()
end
while not turtle.detectDown() do
turtle.down()
end
turtle.back()
turtle.select(1)
turtle.place()
turtle.up()
end
if b<L then
turtle.turnRight()
turtle.forward()
turtle.forward()
end
end
turtle.turnLeft()
for c=1,(x-1) do
turtle.forward()
end
if a<W then
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
end
end
turtle.turnLeft()
for d=1,(y-2) do
turtle.forward()
end
turtle.turnLeft()
end

–When saplings run low

if not turtle.detectDown then turtle.down() end

if turtle.getItemCount(1)>0 then
turtle.select(1)
turtle.drop()
end

for f=1,8 do
rs.setOutput("bottom",true)
sleep(1)
rs.setOutput("bottom",false)
sleep(1)
end
sleep(3)
rs.setOutput("right",true)
sleep(1)
rs.setOutput("right",false)
sleep(5)
end

print("Farming Complete! This tree farming program courtesy of ClAnta :D/>/>")

Note: I'm using CC 1.33, because of stupid Tekkit. I really need to start installing my own mods :P/>/>
MysticT #2
Posted 30 July 2012 - 09:13 PM
On 1.4 update:
dan200 said:
turtles can no longer be destroyed by tree leaves

Maybe that's the problem, in 1.33 turtles can get replaced by the tree.
Ikkalyzte #3
Posted 30 July 2012 - 09:39 PM
I understand that, and had a problem with that at first. However, I can't find the place in the turtle's path where it crosses through any leaves at all. I'll check the code again, I was just wondering if there was some other chunk loading/reloading thing.