Advertisement
Guest User

remote turtle control

a guest
Jun 7th, 2014
1,828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. local tArgs = {...}
  2. local channel = 0
  3. local sSide = "back"
  4.  
  5. -- Get Channel Number
  6. print("What channel?")
  7. channel = tonumber(read())
  8.  
  9. -- Connect
  10. print("Connecting to "..channel)
  11. rednet.open(sSide)
  12. rednet.send(channel, "Init")
  13. local id, msg = rednet.receive(1)
  14.  
  15. if not msg or id ~= channel then
  16. print("Could not connect")
  17. return
  18. end
  19.  
  20. -- Print commands
  21. print("Commands:")
  22. print("Q - Disconnect/Quit")
  23. print("QASD - Move/Turn")
  24. print("Space- Move Up")
  25. print("Shift- Move Down")
  26. print("Y - Mine Up")
  27. print("H - Mine")
  28. print("N - Mine Down")
  29. print("U - Place Up")
  30. print("J - Place")
  31. print("M - Place Down")
  32.  
  33. -- Program Loop
  34. while true do
  35. local event, sc = os.pullEvent("key")
  36.  
  37. if sc == 16 then
  38. rednet.send(channel, sc)
  39. print("Closing")
  40. rednet.close(sSide)
  41. return
  42. elseif sc == 17 or
  43. sc == 30 or
  44. sc == 31 or
  45. sc == 32 or
  46. sc == 42 or
  47. sc == 57 or
  48. sc == 21 or
  49. sc == 22 or
  50. sc == 35 or
  51. sc == 36 or
  52. sc == 49 or
  53. sc == 50 then
  54. rednet.send(channel, sc)
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement