Advertisement
Nokiyen

autoDoorReceiver

Jun 20th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. --[[
  2. ***********
  3.  * autoDoorReceiver
  4.  *
  5.  * argument1: side of wireless modem.
  6.  * argument2: channelID.
  7. **********
  8. ]]
  9.  
  10.  
  11. ----------
  12. -- Variables.
  13. ----------
  14. -- define vars.
  15. local args = {...}
  16. local side = args[1]
  17. local channelID = args[2]
  18.  
  19.  
  20. ----------
  21. -- Main Thread.
  22. ----------
  23. local p = peripheral.wrap(side)
  24. p.open(channelID)
  25.  
  26. while true do
  27.     local eventName, return1, return2, return3, return4, return5 = os.pullEvent()
  28.     if eventName == "modem_message" and tonumber(return2) == channelID then
  29.         sleep(0.5)
  30.         p.transmit(channelID, channelID, channelID)
  31.     end
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement