Advertisement
nnimos

Untitled

May 5th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. -- Code for Recieving PCs
  2.  
  3. function listen()
  4. local modem = peripheral.wrap("right")
  5. modem.open(3)
  6. local event, modemSide, senderChannel,
  7. replyChannel, message, senderDistance = os.pullEvent("modem_message")
  8. modem.close(3)
  9. end
  10.  
  11. function box1()
  12. print("Box 1")
  13. --[[redstone.setOutput("back", true)
  14. os.sleep(99)
  15. redstone.setOutput("back", false)
  16. listen()]]--
  17. end
  18.  
  19. function box2()
  20. print("Box 2")
  21. --[[redstone.setOutput("back", true)
  22. os.sleep(99)
  23. redstone.setOutput("back", false)
  24. listen()]]--
  25. end
  26.  
  27. function box3()
  28. print("Box 3")
  29. --[[redstone.setOutput("back", true)
  30. os.sleep(99)
  31. redstone.setOutput("back", false)
  32. listen()]]--
  33. end
  34.  
  35. function CheckMessage(message1)
  36. if message1 == box1
  37. then
  38. print("ok1")
  39. box1()
  40. elseif message1 == box2
  41. then
  42. print("ok2")
  43. box2()
  44. elseif message == box3
  45. then
  46. print("ok3")
  47. box3()
  48. else
  49. end
  50. end
  51.  
  52. listen()
  53. CheckMessage(message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement