Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function desc()
- shell.run("clear")
- print("The Turtle detects what Block Type is below. It compares the Block with all in his Inv. If the compare is success and the Turtle found the same Block Type of the Block under it in his Inventory than it does the Action for that Block Type was specified.")
- print("")
- print("Notice: The Turtle Slot-Numbers are place like reading a book. From Left to right and top to bottom")
- print("")
- write("Press Enter to Continue")
- x=read()
- shell.run("clear")
- end
- k=0
- if turtle.getItemCount(1) < 1 then
- if k < 1 then
- desc()
- end
- print("Slot 1 Block Type to go forward")
- k=1
- end
- if turtle.getItemCount(2) < 1 then
- if k < 1 then
- desc()
- end
- print("Slot 2 Block Type to go right")
- k=1
- end
- if turtle.getItemCount(3) < 1 then
- if k < 1 then
- desc()
- end
- print("Slot 3 Block Type to go Left")
- print(" (or detect Chest Left)")
- k=1
- end
- if turtle.getItemCount(4) < 1 then
- if k < 1 then
- desc()
- end
- print("Slot 4 Block type to detect tree")
- print(" (in front)")
- k=1
- end
- if turtle.getItemCount(5) < 1 then
- if k < 1 then
- desc()
- end
- print("Slot 5 Wood Block of the Tree Type")
- print("Slot 6 Seeds of the Tree Type")
- k=1
- end
- if turtle.getItemCount(7) < 1 then
- if k < 1 then
- desc()
- end
- print("Slot 7 Dirt")
- k=1
- end
- if turtle.getItemCount(8) < 1 then
- print("Slot 8 Leaves of the Tree Type")
- if k < 1 then
- desc()
- end
- k=1
- end
- if k > 0 then
- print("")
- write("Press ENTER when ready")
- read()
- os.reboot()
- elseif k < 1 then
- print("")
- print("")
- print("")
- print(" Hold Strg + T for 3 sec.")
- print(" to terminate the Programm ")
- end
- function up()
- while not turtle.up() do
- sleep(1)
- end
- end
- function forward()
- while not turtle.forward() do
- sleep(1)
- end
- end
- function down()
- while not turtle.down() do
- sleep(1)
- end
- end
- function back()
- while not turtle.back() do
- sleep(1)
- end
- end
- function suck()
- turtle.select(6)
- for i=1,4 do
- turtle.suck()
- turtle.turnRight()
- end
- end
- function tree()
- turtle.select(9)
- turtle.dig()
- forward()
- h=0
- turtle.digUp()
- up()
- turtle.select(5)
- while turtle.compareUp() do
- if h == 1 then
- turtle.select(6)
- turtle.placeDown()
- end
- turtle.select(5)
- if turtle.compareUp() then
- turtle.select(9)
- else
- turtle.select(6)
- end
- turtle.digUp()
- for i=1,4 do
- turtle.select(6)
- turtle.dig()
- turtle.turnRight()
- end
- up()
- h=h+1
- turtle.select(5)
- end
- while not turtle.detectDown() do
- down()
- end
- back()
- if not turtle.detectDown() then
- down()
- end
- end
- function drop()
- for i=9,16 do
- turtle.select(i)
- while turtle.getItemCount(i) > 0 do
- turtle.drop()
- end
- end
- if turtle.getItemCount(5) > 1 then
- turtle.select(5)
- xlog=turtle.getItemCount(5)
- xlog=xlog-1
- turtle.transferTo(9,xlog)
- drop()
- end
- end
- function detect()
- turtle.select(1)
- if turtle.compareDown() then
- turtle.select(8)
- if turtle.compare() then
- turtle.dig()
- end
- if turtle.detect() then
- up()
- sleep(1)
- down()
- end
- forward()
- end
- turtle.select(2)
- if turtle.compareDown() then
- turtle.turnRight()
- turtle.select(8)
- if turtle.compare() then
- turtle.dig()
- end
- forward()
- end
- turtle.select(3)
- if turtle.compareDown() then
- turtle.turnLeft()
- if turtle.detect() then
- drop()
- turtle.select(6)
- turtle.suckUp()
- turtle.turnRight()
- end
- forward()
- end
- turtle.select(4)
- if turtle.compareDown() then
- turtle.select(5)
- if turtle.compare() then
- tree()
- end
- if not turtle.detect() then
- if turtle.getItemCount(6) > 1 then
- turtle.select(6)
- turtle.place()
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- forward()
- end
- end
- function relocate()
- turtle.select(1)
- if turtle.compareDown() then
- else
- turtle.select(2)
- if turtle.compareDown() then
- turtle.select(8)
- if turtle.compare() then
- turtle.dig()
- end
- if turtle.detect() then
- turtle.turnRight()
- end
- forward()
- if not turtle.detectDown() then
- back()
- turtle.turnRight()
- forward()
- end
- turtle.select(1)
- if turtle.compareDown() then
- else
- turtle.select(3)
- if turtle.compareDown() then
- turtle.forward()
- else
- back()
- turtle.turnRight()
- forward()
- end
- end
- else
- turtle.select(3)
- if turtle.compareDown() then
- if turtle.detect() then
- drop()
- turtle.turnRight()
- forward()
- else
- forward()
- end
- else
- turtle.select(4)
- if turtle.compareDown() then
- if turtle.detect() then
- turtle.select(5)
- if turtle.compare() then
- else
- turtle.select(6)
- if turtle.compare() then
- else
- turtle.select(8)
- if turtle.compare() then
- turtle.dig()
- else
- up()
- sleep(1)
- down()
- end
- end
- end
- else
- forward()
- if not turtle.detectDown() then
- back()
- turtle.turnLeft()
- if not turtle.forward() then
- if turtle.detect() then
- os.reboot()
- end
- else
- if turtle.detect() then
- os.reboot()
- end
- end
- end
- turtle.select(1)
- if turtle.compareDown() then
- else
- turtle.select(7)
- if turtle.compareDown() then
- back()
- back()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- end
- end
- turtle.select(6)
- if turtle.compareDown() then
- up()
- end
- if not turtle.detectDown() then
- if turtle.detectUp() then
- while turtle.detectUp() do
- turtle.select(9)
- turtle.digUp()
- up()
- end
- else
- turtle.up()
- while turtle.detectUp() do
- turtle.select(9)
- turtle.digUp()
- up()
- end
- end
- while not turtle.detectDown() do
- down()
- end
- turtle.select(6)
- if turtle.compareDown() then
- turtle.digDown()
- down()
- end
- elseif turtle.detectUp() then
- while turtle.detectUp() do
- turtle.select(9)
- turtle.digUp()
- up()
- end
- while not turtle.detectDown() do
- down()
- end
- turtle.select(6)
- if turtle.compareDown() then
- turtle.digDown()
- down()
- end
- end
- turtle.select(7)
- if turtle.compareDown() then
- turtle.select(4)
- while not turtle.compareDown() do
- back()
- if turtle.compareDown() then
- turtle.turnLeft()
- turtle.turnLeft()
- else
- forward()
- turtle.turnRight()
- end
- end
- forward()
- end
- end
- end
- end
- end
- relocate()
- while true do
- detect()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement