Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require 'robot'
- local diameter, depth, x, z, y
- function getNumberInput(message)
- local validInput = false
- local userInput
- while not validInput do
- io.write(message)
- io.flush()
- userInput = io.read()
- validInput = tonumber(userInput) ~= nil
- if not validInput then
- io.write("Please enter a numeric value")
- io.flush()
- end
- end
- return tonumber(userInput)
- end
- function digForward(blocksToDig)
- local cannotMove
- for i = 0, blocksToDig, 1 do
- cannotMove = robot.detect()
- if cannotMove then
- robot.swing()
- end
- robot.forward()
- end
- end
- diameter = getNumberInput("What size hole should I dig?")
- depth = getNumberInput("How deep should I dig? (-1 means I'll go till bedrock WARNING DO NOT DO THIS IF THERE IS NO BEDROCK ONLY VOID!!!)")
- print(diameter)
- print(depth)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement