Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Mitchfizz05's elevator turtle
- local floorSpacing = 4
- local function home()
- print("Homing turtle to ground floor...")
- currentFloor = 0
- while turtle.down() do end
- end
- home()
- local function mainLoop()
- term.clear()
- term.setCursorPos(1,1)
- print("Elevator turtle")
- print()
- term.write(" Enter floor number: ")
- local floorNum = tonumber(read())
- if (floorNum == nil) then
- print("Invalid floor number")
- sleep(0.75)
- return
- end
- floorNum = floorNum - 1
- -- Go up to target floor
- for i = 1, (floorNum * floorSpacing), 1 do
- while not turtle.up() do end
- end
- print("You have arrived!")
- sleep(2)
- home()
- end
- while true do
- mainLoop()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement