Willibilly19

Move

Dec 17th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. term.clear()
  2. term.setCursorPos(1,1)
  3.  
  4. print("Welcome to Quick Move.")
  5. print("To begin, read the movement codes")
  6. print("and make sure your turtle is fueled.")
  7. print("Forward - 'w'")
  8. print("Backward - 's'")
  9. print("Up - 'q'")
  10. print("Down - 'e'")
  11. print("Turn Left - 'a'")
  12. print("Turn Right - 'd'")
  13. print("Dig - 'x'")
  14. print("Exit - Left CTRL")
  15.  
  16. while true do
  17.  local event, param1 = os.pullEvent()
  18.  if event == "key" then
  19.   if param1 == 17 then -- 'w'
  20.    turtle.forward()
  21.   end
  22.   if param1 == 30 then -- 'a'
  23.    turtle.turnLeft()
  24.   end
  25.   if param1 == 31 then -- 's'
  26.    turtle.back()
  27.   end
  28.   if param1 == 32 then -- 'd'
  29.    turtle.turnRight()
  30.   end
  31.   if param1 == 16 then -- 'q'
  32.    turtle.up()
  33.   end
  34.   if param1 == 18 then -- 'e'
  35.    turtle.down()
  36.   end
  37.   if param1 == 45 then -- 'x'
  38.    turtle.dig()
  39.   end
  40.   if param1 == 29 then -- Left CTRL
  41.    term.clear()
  42.    term.setCursorPos(1,1)
  43.    break
  44.   end
  45.  end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment