Advertisement
Jameelo

Turtle Elevator

Feb 19th, 2023 (edited)
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | Gaming | 0 0
  1. --[[
  2.     I'm too lazy to use ladders to reach my mining turtle
  3.     So I'm gonna make the turtle into an elevator
  4.     TRUE == UP
  5. ]]
  6.  
  7. print("Elevator mode activated")
  8.  
  9. while DIRECTION == nil do
  10.     print("Up or down?")
  11.     directionChoice = string.lower(tostring(read()))
  12.     acceptedResponses = {"up","down","u","d"}
  13.  
  14.     for index,value in pairs(acceptedResponses) do
  15.         if directionChoice == value then
  16.             if index%2==1 then
  17.                 DIRECTION = 1
  18.                 break
  19.             else
  20.                 DIRECTION = 0
  21.                 break
  22.             end
  23.         end
  24.     end
  25.     if DIRECTION == nil then
  26.         print("Invalid input, try again")
  27.     end
  28. end
  29.  
  30. print("By how many blocks")
  31. distance = string.lower(tostring(read()))
  32.  
  33.  
  34. if DIRECTION == 1 then
  35.     for _ = 1,distance do
  36.         turtle.up()
  37.     end
  38. elseif DIRECTION == 0 then
  39.     for _ = 1,distance do
  40.         turtle.down()
  41.     end
  42. else
  43.     print("error")
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement