Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- howFarDist = 0
- function howFarFunc()
- howFarDist = read()
- if tonumber(howFarDist) ~= nil then
- howFarDist = tonumber(howFarDist)
- else
- textutils.slowPrint("Please enter a numeric value")
- sleep(1)
- term.clear()
- textutils.slowPrint("How far would you like to go?")
- howFarFunc()
- end
- if howFarDist <= 0 then
- textutils.slowPrint("You cannot move the turtle")
- textutils.slowPrint("0 or less blocks, stupid.")
- sleep(1)
- term.clear()
- textutils.slowPrint("How far would you like to go?")
- howFarFunc()
- end
- end
- function confirm(direction)
- term.clear()
- textutils.slowPrint("So...")
- sleep(2)
- textutils.slowPrint("You would like the turtle to:")
- sleep(1)
- textutils.slowPrint("Travel "..howFarDist.." blocks.")
- textutils.slowPrint("(Facing "..direction..".)")
- sleep(1)
- textutils.slowPrint("Is this correct?")
- textutils.slowPrint("(Type Y for yes or anything else for no.)")
- YorNinput = read()
- if YorNinput == "Y" then
- term.clear()
- textutils.slowPrint("Starting...")
- if direction == "left" then
- turtle.turnLeft()
- elseif direction == "right" then
- turtle.turnRight()
- elseif direction == "back" then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- sleep(1)
- else
- term.clear()
- textutils.slowPrint("Okay then... Restarting program.")
- sleep(1)
- term.clear()
- Main()
- end
- end
- local howFar = "How far would you like to go "
- function Start()
- term.clear()
- Main()
- end
- function Main()
- textutils.slowPrint("Hello user!")
- sleep(1)
- textutils.slowPrint("What direction do you want me")
- textutils.slowPrint("to go in?")
- local dirinput = read()
- if dirinput == "left" then
- textutils.slowPrint(howFar.."left?")
- howFarFunc()
- confirm("left")
- elseif dirinput == "right" then
- textutils.slowPrint(howFar.."right?")
- howFarFunc()
- confirm("right")
- elseif dirinput == "forward" then
- textutils.slowPrint(howFar.."forward?")
- howFarFunc()
- confirm("forward")
- elseif dirinput == "back" then
- textutils.slowPrint(howFar.."back?")
- howFarFunc()
- confirm("back")
- else
- textutils.slowPrint("Please input either:")
- textutils.slowPrint("\"forward\"")
- sleep(1)
- textutils.slowPrint("\"back\"")
- sleep(1)
- textutils.slowPrint("\"left\"")
- sleep(1)
- textutils.slowPrint("or")
- sleep(1)
- textutils.slowPrint("\"right\"")
- sleep(2)
- textutils.slowPrint("Restarting program...")
- sleep(2)
- term.clear()
- Main()
- end
- end
- Start()
Advertisement
Add Comment
Please, Sign In to add comment