Posted 31 December 2014 - 02:12 AM
Hi guys and girls,
I am doing a program named wood that basically cut trees and plant them back. Their is no refuel part for now.
When I try to run it, the error " turtle:22:slot number 0 out of range ". I have no idea how to fix it. Thank you for helping me.
pastebin: http://pastebin.com/wgn5YTS4
I am doing a program named wood that basically cut trees and plant them back. Their is no refuel part for now.
When I try to run it, the error " turtle:22:slot number 0 out of range ". I have no idea how to fix it. Thank you for helping me.
pastebin: http://pastebin.com/wgn5YTS4
--Wood
--------------------
--| slot | item |
---------+----------
--| 1 | gravel |
--| 2 | wood |
--| 3 | sand |
--| 4 | stone |
--| 5 | sapling |
--| 6 | slab |
--| 16 | fuel |
--------------------
turtle.select(4) --stone
if turtle.compareDown() then
go()
turtle.select(3) --sand
if turtle.compareDown() then
turtle.turnLeft()
cut()
plant()
turtle.turnRight()
else
turtle.select(6) --slab
if turtle.compareDown() then
cut()
plant()
turtle.turnRight()
else
turtle.select(4) --stone
if turtle.compareDown() then
turtle.turnRight()
end
end
end
end
function go() --avance
print("going")
turtle.select(1) --gravel
turtle.forward()
while turtle.compareDown() do
turtle.forward()
end
end
function plant()
print("planting")
if not turtle.detect() then
turtle.select(5) --sapling
turtle.place()
end
end
function cut()
print("cutting")
turtle.select(2) --wood
if turtle.compare() then
turtle.dig()
turtle.forward()
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while not turtle.detectDown() do
turtle.down()
end
turtle.back()
end
if not turtle.detect() then
plant()
end
end
Edited on 31 December 2014 - 05:24 AM