Sir_Popsilots

obsMiner

Feb 23rd, 2022 (edited)
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. local function Move(key)
  2.     print("trying to move" , key)
  3.     if key == 265 then --up arrow
  4.         turtle.forward()
  5.     elseif key == 264 then -- down arrow
  6.         turtle.back()
  7.     elseif key == 262 then -- right arrow
  8.         turtle.turnRight()
  9.     elseif key == 261 then -- left arrow
  10.         turtle.turnLeft()
  11.     elseif key == 344 then -- right shift
  12.         turtle.digUp()
  13.         turtle.up()
  14.     elseif key == 345 then -- right control
  15.         turtle.digDown()
  16.         turtle.down()
  17.     end
  18. end
  19.  
  20. print("program started")
  21.  
  22. while true do
  23.     local event, key, is_held = os.pullEvent("key")
  24.     if key == 32 then
  25.         turtle.dig()
  26.     else
  27.         Move(key)
  28.     end
  29. end
Add Comment
Please, Sign In to add comment