Advertisement
nnimos

Untitled

May 5th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 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. if message1 == 1
  38. then
  39. print("ok1")
  40. box1()
  41. elseif message1 == 2
  42. then
  43. print("ok2")
  44. box2()
  45. elseif message == 3
  46. then
  47. print("ok3")
  48. box3()
  49. else
  50. end
  51. end
  52.  
  53. --program
  54.  
  55. listen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement