marko_rus

CC turtle control

Oct 7th, 2021 (edited)
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. local call
  2. local button = 0
  3.  
  4. print("W,A,S,D,Q,E - control. R - refuel. Z - DigDown. X - Dig. C - DigUp. F = exit")
  5. while true do
  6. while call ~= "char" do
  7. call, button = os.pullEvent()
  8. end
  9.  
  10.     if button == 'w' then
  11.         turtle.forward()
  12.     end
  13.    
  14.     if button == 's' then
  15.         turtle.back()
  16.     end
  17.    
  18.     if button == 'a' then
  19.         turtle.turnLeft()
  20.     end
  21.    
  22.     if button == 'd' then
  23.         turtle.turnRight()
  24.     end
  25.    
  26.     if button == 'q' then
  27.         turtle.down()
  28.     end
  29.    
  30.     if button == 'e' then
  31.         turtle.up()
  32.     end
  33.    
  34.     if button == 'f' then
  35.         return 0
  36.     end
  37.  
  38.     if button == 'r' then
  39.         turtle.refuel()
  40.     end
  41.  
  42.     if button == 'z' then
  43.         turtle.digDown()
  44.     end
  45.    
  46.     if button == 'x' then
  47.         turtle.dig()
  48.     end
  49.  
  50.     if button == 'c' then
  51.         turtle.digUp()
  52.     end
  53.    
  54.     call = ""
  55.     button = 0
  56. end
Add Comment
Please, Sign In to add comment