Advertisement
svennp

simplemove

Nov 4th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. -- simplemove
  2.  
  3. print("use arrow keys to move")
  4. print("ctrl mines blocks from over under and in front")
  5. print("space and shift goes up and down")
  6. print("press enter to exit")
  7.  
  8.  
  9. function refuel()
  10.     if turtle.getFuelLevel() < 10 then
  11.         for i=1,16 do
  12.             if turtle.getItemCount(i) > 0 then
  13.                 turtle.select(i)
  14.                 if turtle.refuel(1) then
  15.                     break
  16.                 end
  17.             end
  18.         end
  19.     end
  20. end
  21.  
  22. while true do
  23.     refuel()
  24.     ev,p1 = os.pullEvent()
  25.     if p1 == 200 then
  26.         turtle.forward()
  27.     elseif p1 == 208 then
  28.         turtle.back()
  29.     elseif p1 == 205 then
  30.         turtle.turnRight()
  31.     elseif p1 == 203 then
  32.         turtle.turnLeft()
  33.     elseif p1 == 57 then
  34.         turtle.up()
  35.     elseif p1 == 42 or p1 == 54 then
  36.         turtle.down()
  37.     elseif p1 == 157 or p1 == 29 then
  38.         turtle.dig()
  39.         turtle.digDown()
  40.         turtle.digUp()
  41.     elseif p1 == 28 then
  42.         break
  43.     end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement