Advertisement
Guest User

Untitled

a guest
May 25th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 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("WASD - 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 == keys.q then
  38. rednet.send(channel, sc)
  39. print("Closing")
  40. rednet.close(sSide)
  41. return
  42. elseif sc == keys.k or
  43. sc == keys.w or
  44. sc == keys.a or
  45. sc == keys.s or
  46. sc == keys.d or
  47. sc == keys.space or
  48. sc == keys.leftCtrl or
  49. sc == keys.up or
  50. sc == keys.left or
  51. sc == keys.down or
  52. sc == keys.i or
  53. sc == keys.j then
  54. rednet.send(channel, sc)
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement