Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local youAreDead = function()
- turtle.up()
- end
- local placeBlock = function()
- local count = turtle.getItemCount(turtle.getSelectedSlot())
- if count == 0 then
- repeat
- if turtle.getSelectedSlot() == 16 then
- error("Ran out of blocks.")
- else
- turtle.select(turtle.getSelectedSlot() + 1)
- end
- until (turtle.getItemCount(turtle.getSelectedSlot()) > 0)
- else
- turtle.place()
- end
- end
- local doTheMoving = function()
- local sight = turtle.inspect()
- if sight then
- youAreDead()
- else
- turtle.back()
- placeBlock()
- end
- end
- local getInput = function()
- while true do
- local evt = {os.pullEvent()}
- if evt[1] == "key" then
- local key = evt[2]
- if key == keys.left then
- turtle.turnRight()
- elseif key == keys.right then
- turtle.turnLeft()
- end
- end
- end
- end
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- print("Wireless plethora keyboards are strongly recommended.")
- sleep(0)
- os.pullEvent("char")
- turtle.turnRight()
- turtle.turnRight()
- write("Ready, ")
- sleep(0.5)
- write("Set, ")
- sleep(0.5)
- write("GO!")
- parallel.waitForAny(doTheMoving, getInput)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement