Advertisement
Guest User

spawn

a guest
Aug 31st, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. rednet.open("bottom")
  2.  
  3. local interval = 30
  4.  
  5. os.queueEvent("timer")
  6. while true do
  7.   local ev, p1, p2 = os.pullEvent()
  8.  
  9.   if ev == "timer" then
  10.     os.startTimer(interval)
  11.   end
  12.  
  13.   if ev == "rednet_message" then
  14.     local tbl = {}
  15.     print("Message:"..p2)
  16.    
  17.     for i in string.gmatch(p2,"%S+") do
  18.       table.insert(tbl,i)
  19.     end
  20.        
  21.     if tbl[1] == os.getComputerLabel() then
  22.       if tbl[2] == "on" then
  23.         rs.setOutput("top",true)
  24.       end
  25.    
  26.       if tbl[2] == "off" then
  27.         rs.setOutput("top",false)
  28.       end
  29.     end
  30.   end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement