Advertisement
nnimos

Untitled

May 5th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 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. CheckMessage(message)
  10. end
  11.  
  12. function box1()
  13. print("Box 1")
  14. --[[redstone.setOutput("back", true)
  15. os.sleep(99)
  16. redstone.setOutput("back", false)
  17. listen()]]--
  18. end
  19.  
  20. function box2()
  21. print("Box 2")
  22. --[[redstone.setOutput("back", true)
  23. os.sleep(99)
  24. redstone.setOutput("back", false)
  25. listen()]]--
  26. end
  27.  
  28. function box3()
  29. print("Box 3")
  30. --[[redstone.setOutput("back", true)
  31. os.sleep(99)
  32. redstone.setOutput("back", false)
  33. listen()]]--
  34. end
  35.  
  36. function CheckMessage(message1)
  37. local boxes1 = "box1"
  38. local boxes2 = "box2"
  39. local boxes3 = "box3"
  40. if message1 == "boxes1"
  41. then
  42. print("ok1")
  43. box1()
  44. elseif message1 == "boxes2"
  45. then
  46. print("ok2")
  47. box2()
  48. elseif message == "boxes3"
  49. then
  50. print("ok3")
  51. box3()
  52. else
  53. end
  54. end
  55.  
  56. --program
  57.  
  58. listen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement