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

tree framing

Started by kasp606g, 24 December 2012 - 11:48 AM
kasp606g #1
Posted 24 December 2012 - 12:48 PM
term.clear()
term.setCursorPos(1,1)
print("I am set up to tree fram.")
print("There should be a dropoff chest behind me.")
print("\(y/n\)")
while true do
event, character = os.pullEvent()
if event == "char" and character == "y" then
print("Initializing…")
sleep(1)
break
elseif event == "char" and character == "n" then
print("Please set up correctly.")
error()
end
end

term.clear()
term.setCursorPos(1,1)
print("There should be this in my inventory :")
print("Slot :1 = coal or chearcoal(1:Stack)")
print("Slot :15 bone meal")
print("Slot :16 sapling")
print("Is this how I am set up?")
print("\(y/n\)")

while true do
event, character = os.pullEvent()
if event == "char" and character == "y" then
print("Initializing…")
sleep(1)
term.clear()
term.setCursorPos(1,1)
break
elseif event == "char" and character == "n" then
term.clear()
term.setCursorPos(1,1)
print("Please set up correctly.")
sleep(1)
error()
end
end

local function Plant()
turtle.select(16)
turtle.place()
if turtle.detect() then
turtle.select(15)
turtle.place()
end
end

local function checkFuel()
if turtle.getFuelLevel() < 20 then
turtle.select(1)
turtle.refuel(1)
end
end

local function wood()
if turtle.detect() then
turtle.dig()
turtle.forward()
end
end

local function woodUp()
if turtle.detectUp() then
turtle.digUp()
turtle.up()
end
end

local function Back()
turtle.down()
if turtle.detectDown() then
turtle.turnRight()
turtle.turnRight()
turtle.down()
turtle.forward()
turtle.select(2)
turtle.drop()
turtle.turnRight()
turtle.turnRight()
turtle.select(1)
sleep(3)
end
end



local function woodDown()
if turtle.detectUp() then
checkFuel()
woodUp()
end
end


local function Going()
while true do
Plant()
checkFuel()
wood()
for i = 1,18 do
woodDown()
end

for i = 1,16 do
Back()
end
end
end

Going()
kasp606g #2
Posted 29 December 2012 - 04:32 AM
term.clear()
term.setCursorPos(1,1)
print("I am set up to tree fram.")
print("There should be a dropoff chest behind me.")
print("\(y/n\)")
while true do
event, character = os.pullEvent()
if event == "char" and character == "y" then
print("Initializing…")
sleep(1)
break
elseif event == "char" and character == "n" then
print("Please set up correctly.")
error()
end
end

term.clear()
term.setCursorPos(1,1)
print("There should be this in my inventory :")
print("Slot :1 = coal or chearcoal(1:Stack)")
print("Slot :15 bone meal")
print("Slot :16 sapling")
print("Is this how I am set up?")
print("\(y/n\)")

while true do
event, character = os.pullEvent()
if event == "char" and character == "y" then
print("Initializing…")
sleep(1)
term.clear()
term.setCursorPos(1,1)
break
elseif event == "char" and character == "n" then
term.clear()
term.setCursorPos(1,1)
print("Please set up correctly.")
sleep(1)
error()
end
end

local function Plant()
turtle.select(16)
turtle.place()
if turtle.detect() then
turtle.select(15)
turtle.place()
end
end

local function checkFuel()
if turtle.getFuelLevel() < 20 then
turtle.select(1)
turtle.refuel(1)
end
end

local function wood()
if turtle.detect() then
turtle.dig()
turtle.forward()
end
end

local function woodUp()
if turtle.detectUp() then
turtle.digUp()
turtle.up()
end
end

local function Back()
turtle.down()
if turtle.detectDown() then
turtle.turnRight()
turtle.turnRight()
turtle.down()
turtle.forward()
turtle.select(2)
turtle.drop()
turtle.turnRight()
turtle.turnRight()
turtle.select(1)
sleep(3)
end
end



local function woodDown()
if turtle.detectUp() then
checkFuel()
woodUp()
end
end


local function Going()
while true do
Plant()
checkFuel()
wood()
for i = 1,18 do
woodDown()
end

for i = 1,16 do
Back()
end
end
end

Going()