Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function r()
- checkMat()
- end
- function matsList()
- print("Please make sure you have the following:")
- print("Use solid blocks as building material")
- print("64 of a building material in slot 1")
- print("45 of a building material in slot 2")
- print("1 furnace in slot 3")
- print("6 chests in slot 4")
- print("1 hopper in slot 5")
- print("1 dirt in slot 6")
- print("1 sapling in slot 7")
- print("one charcoal or coal in slot 8")
- print("Press any key when you have supplied the materials")
- local event, key = os.pullEvent("key")
- if key then
- print("Checking materials..")
- sleep(1)
- r()
- end
- end
- function checkMat()
- turtle.getItemCount(1)
- turtle.getItemCount(2)
- turtle.getItemCount(3)
- turtle.getItemCount(4)
- turtle.getItemCount(5)
- turtle.getItemCount(6)
- turtle.getItemCount(7)
- turtle.getItemCount(8)
- if turtle.getItemCount(1) == 64 and
- turtle.getItemCount(2) == 45 and
- turtle.getItemCount(3) == 1 and
- turtle.getItemCount(4) == 6 and
- turtle.getItemCount(5) == 1 and
- turtle.getItemCount(6) == 1 and
- turtle.getItemCount(7) == 1 and
- turtle.getItemCount(8) == 1 then
- print("Sufficient matierals!")
- sleep(1)
- print("Beginning to build farm...")
- buildFarm()
- else
- print("Insufficent materials!")
- sleep(1)
- matsList()
- end
- end
- --farm building
- function f()
- turtle.forward()
- end
- function buildFarm()
- --farm building
- --square wall
- turtle.up()
- turtle.up()
- f()
- turtle.select(1)
- turtle.placeDown()
- turtle.turnRight()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- --lower platform
- turtle.turnLeft()
- f()
- turtle.down()
- turtle.placeDown()
- turtle.turnRight()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.turnLeft()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnRight()
- f()
- turtle.placeDown()
- turtle.turnRight()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.turnLeft()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.select(2)
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.turnRight()
- f()
- turtle.placeDown()
- turtle.turnRight()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnLeft()
- f()
- turtle.turnLeft()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- turtle.turnRight()
- f()
- turtle.placeDown()
- turtle.turnRight()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- f()
- turtle.placeDown()
- --ditch thingy
- f()
- turtle.down()
- turtle.turnLeft()
- f()
- turtle.turnLeft()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- turtle.back()
- turtle.place()
- turtle.digDown()
- turtle.placeDown()
- turtle.back()
- turtle.digDown()
- turtle.placeDown()
- turtle.back()
- turtle.digDown()
- turtle.placeDown()
- turtle.back()
- turtle.digDown()
- turtle.back()
- turtle.digDown()
- turtle.placeDown()
- turtle.back()
- turtle.digDown()
- turtle.placeDown()
- turtle.back()
- turtle.digDown()
- turtle.placeDown()
- --storage 'n' stuff
- f()
- turtle.up()
- turtle.up()
- turtle.turnLeft()
- f()
- turtle.turnLeft()
- turtle.back()
- turtle.select(4)
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.back()
- turtle.place()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- f()
- turtle.turnLeft()
- f()
- f()
- f()
- turtle.down()
- --furnace
- turtle.select(3)
- turtle.place()
- turtle.select(8)
- turtle.drop()
- --chests and hopper
- turtle.down()
- turtle.digDown()
- turtle.down()
- turtle.turnLeft()
- turtle.dig()
- turtle.digDown()
- turtle.down()
- turtle.dig()
- f()
- turtle.dig()
- f()
- turtle.select(4)
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.up()
- turtle.placeDown()
- turtle.up()
- turtle.select(5)
- turtle.placeDown()
- --dirt and sapling
- turtle.up()
- turtle.turnLeft()
- turtle.turnLeft()
- f()
- f()
- f()
- turtle.select(6)
- turtle.up()
- turtle.place()
- turtle.select(7)
- turtle.up()
- turtle.place()
- end
- function chopTree()
- turtle.select(2)
- turtle.dig()
- f()
- turtle.select(1)
- turtle.compareUp()
- while turtle.compareUp() == true do
- turtle.select(2)
- turtle.digUp()
- turtle.up()
- end
- print("Turtle finished chopping, returning...")
- goDown()
- end
- function goDown()
- turtle.detectDown()
- while turtle.detectDown() == false do
- turtle.down()
- end
- turtle.back()
- turtle.select(3)
- turtle.place()
- end
- function status()
- turtle.getFuelLevel()
- turtle.getItemCount(2)
- turtle.getItemCount(3)
- if turtle.getFuelLevel() < 100 or turtle.getItemCount(2) > 40 or turtle.getItemCount(3) < 10 then
- toHub()
- end
- end
- function logStat()
- if turtle.getItemCount(2) > 40 then
- turtle.turnLeft()
- turtle.select(2)
- turtle.drop(64)
- turtle.turnRight()
- end
- end
- function saplingStat()
- if turtle.getItemCount(3) < 5 then
- turtle.back()
- turtle.down()
- turtle.down()
- turtle.down()
- turtle.down()
- turtle.select(3)
- turtle.suck(32)
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.up()
- f()
- end
- end
- function fuelStat()
- if turtle.getFuelLevel() < 100 then
- turtle.select(4)
- turtle.turnLeft()
- turtle.suck(8)
- turtle.turnRight()
- turtle.back()
- turtle.turnRight()
- f()
- turtle.dropDown()
- turtle.back()
- turtle.down()
- turtle.down()
- f()
- sleep(80)
- turtle.select(5)
- turtle.suckUp(7)
- turtle.refuel()
- turtle.suckUp()
- turtle.back()
- turtle.up()
- turtle.drop()
- turtle.up()
- turtle.turnLeft()
- f()
- end
- end
- function toHub()
- turtle.down()
- turtle.down()
- turtle.back()
- turtle.back()
- turtle.up()
- turtle.back()
- turtle.back()
- turtle.back()
- logStat()
- saplingStat()
- fuelStat()
- f()
- f()
- f()
- turtle.down()
- f()
- f()
- turtle.up()
- turtle.up()
- end
- function menu()
- term.setCursorPos(1,1)
- print("Welcome to SimpleWoodChop by yk88 and DemonBabby")
- print("Type 'build' to begin building the farm")
- print("Type 'chop' to begin the independent chopping program")
- print("Type 'left' or 'right' to make sure the turtle is facing")
- print("away from the chests and furnaces.")
- userInput = io.read()
- if string.lower(userInput) == "build" then
- matsList()
- print("Please put water along the top row in front of the turtle, and in the two bottom corners behind the turtle.")
- print("Press any key to start the chopping program")
- local key = os.pullEvent("key")
- if key then
- print("Starting chopping program")
- checkGrowth()
- end
- elseif string.lower(userInput) == "chop" then
- term.clear()
- term.setCursorPos(1,1)
- print("Please make sure the turtle is placed in front of the tree")
- checkGrowth()
- elseif string.lower(userInput) == "left" then
- turtle.turnLeft()
- print("Turning left one time..")
- sleep(1.5)
- rMenu()
- elseif string.lower(userInput) == "right" then
- turtle.turnRight()
- print("Turning right one time..")
- sleep(1.5)
- rMenu()
- else
- print("Unkown command")
- sleep(1)
- rMenu()
- end
- end
- function rMenu()
- term.clear()
- menu()
- end
- function turnCheck()
- turtle.select(1)
- turtle.compare(1)
- if turtle.compare(1) == true then
- print("Tree growth detected!")
- chopTree()
- end
- sleep(8)
- turtle.turnRight()
- turtle.select(1)
- turtle.compare(1)
- if turtle.compare(1) == true then
- print("Tree growth detected!")
- chopTree()
- end
- sleep(8)
- turtle.turnRight()
- turtle.select(1)
- turtle.compare(1)
- if turtle.compare(1) == true then
- print("Tree growth detected!")
- chopTree()
- end
- sleep(8)
- turtle.turnRight()
- turtle.select(1)
- turtle.compare(1)
- if turtle.compare(1) == true then
- print("Tree growth detected!")
- chopTree()
- end
- sleep(8)
- turtle.turnRight()
- status()
- end
- function checkGrowth()
- print("Make sure there is one log of the in the first slot, and at least 2 saplings in the third slot.")
- print("Press any key to continue...")
- local key = os.pullEvent("key")
- if key then
- turtle.getItemCount(1)
- turtle.getItemCount(3)
- if turtle.getItemCount(1) == 1 and turtle.getItemCount(3) > 1 then
- print("Initiating chopping program..")
- while true do
- turnCheck()
- end
- else
- print("Not enough/too many resources")
- sleep(2)
- rCheckGrowth()
- end
- end
- end
- function rCheckGrowth()
- term.clear()
- term.setCursorPos(1,1)
- checkGrowth()
- end
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement