Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- turtle.refuel(1)
- turtle.up()
- o = 1
- -- Checks for trees
- local function compareT()
- turtle.select(3) -- select slot 3
- turtle.suckDown()
- if turtle.compare() then -- if space in front is slot 3(a tree)
- turtle.dig() -- dig said tree
- turtle.forward() -- move to where tree was
- turtle.digDown() -- take out bottom tree block
- turtle.select(2) -- select sapling
- turtle.placeDown() -- place sapling
- turtle.select(3) -- select tree again
- turtle.digUp() -- dig 3rd tree spot
- turtle.up() -- move up to 3rd tree spot
- turtle.digUp() -- dig 4th tree spot
- turtle.up() -- move up to 4th tree spot
- turtle.digUp() -- dig possible 5th tree spot
- turtle.up() -- move up to possible 5th tree spot
- if turtle.compareUp() then -- checks if there is another tree on 6th spot
- turtle.digUp() -- if there is, he will dig it
- turtle.up() -- then he will move up
- if turtle.compareUp() then -- repeat last check
- turtle.digUp()
- else
- turtle.down()
- end
- else
- turtle.down()
- end
- turtle.down()
- turtle.down()
- turtle.down()
- turtle.select(1) -- select slot 1 again
- else
- turtle.forward()
- turtle.select(1)
- end
- end
- -- Function to get the number of items in a given slot
- local function bcount()
- return turtle.getItemCount(p)
- end
- -- Function to get the fuel level of the robot
- local function fcount()
- return turtle.getFuelLevel()
- end
- -- check function
- local function check()
- print ("My current fuel level is " .. fcount())
- turtle.suckDown()
- if fcount() < 1 then
- print ("Attempting to eat my fuel...")
- if turtle.getItemCount(1) < 1 then
- print ("I am out of fuel...")
- o = 0
- end
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- repeat
- for t=1, 40 do
- compareT()
- check()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- until o < 1
Advertisement
Add Comment
Please, Sign In to add comment