Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Program name : stairs building Turtle
- -- description : with this program you can with a turtle digging stairs
- -- developer : JohnnyNordx
- -- updated on : 20-03-2015
- function up()
- turtle.up()
- for ux=2, lay do
- while turtle.detect() do
- turtle.dig()
- end
- sleep(0.5)
- if turtle.detect() then
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- turtle.up()
- turtle.digUp()
- end
- end
- function down()
- -- 0 lay
- turtle.digDown()
- -- 1 lay
- turtle.down()
- while turtle.detect() do
- turtle.dig()
- end
- sleep(0.5)
- if turtle.detect() then
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- turtle.forward()
- turtle.digDown()
- -- 2 lay
- turtle.down()
- while turtle.detect() do
- turtle.dig()
- end
- sleep(0.5)
- if turtle.detect() then
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- while turtle.detect() do
- turtle.dig()
- end
- sleep(0.5)
- if turtle.detect() then
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- -- 2-3 lay
- turtle.forward()
- turtle.digUp()
- while turtle.detect() do
- turtle.dig()
- end
- sleep(0.5)
- if turtle.detect() then
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- turtle.digDown()
- -- 3 lay
- turtle.down()
- turtle.digDown()
- lay = lay-3
- for dx=2,lay do
- while turtle.detect() do
- turtle.dig()
- end
- sleep(0.5)
- if turtle.detect() then
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- end
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- turtle.dig()
- turtle.down()
- turtle.digDown()
- end
- end
- function fuel()
- term.write("put fuel in slot 1 (if is more then 64 put it in next slot)")
- line()
- term.write("Press S to start")
- while true do
- local sEvent, param = os.pullEvent("key")
- if sEvent == "key" then
- if param == 31 then
- cl()
- print("Turtle Running")
- break
- end
- end
- end
- for slot=1,16 do
- turtle.select(slot)
- turtle.refuel()
- end
- end
- function cl()
- term.clear()
- lx = "0"
- line()
- end
- function line()
- lx = lx+1
- term.setCursorPos(1,lx)
- end
- lx = "0"
- -- terminal menu
- cl()
- term.write("Stairs Building Turtle")
- line()
- term.write("Up = from below and if selected,")
- line()
- term.write(" right up to the sky")
- line()
- term.write("Down = from top and if selected,")
- line()
- term.write(" right down to the bedrock")
- line()
- line()
- term.write("Up/Down : ")
- term.setCursorBlink(true)
- ud = read()
- if ud == "Up" or ud == "up" then
- line()
- term.write("how many layers ? : ")
- lay = read()
- fuel()
- up()
- elseif ud == "Down" or ud == "down" then
- line()
- term.write("how many layers ? : ")
- lay = read()
- fuel()
- down()
- else
- os.reboot()
- end
- cl()
- write("completed")
- line()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement