Advertisement
Guest User

GlassSensor

a guest
Oct 20th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. bridge = peripheral.wrap("top")
  2. modemr = peripheral.wrap("back")
  3.  
  4.  
  5. while 1==1 do
  6.  
  7.  
  8.   modemr.open(1310)
  9.   _,_,_,_,cxymsg = os.pullEvent()
  10.   modemr.close(1310)
  11.  
  12.   cxymsgunser = textutils.unserialize(cxymsg)
  13.  
  14.  
  15.   numtotal = ((#cxymsgunser)/3)
  16.  
  17.   bridge.addBox(10,10,48,48,0x000000)
  18.  
  19.  
  20.   for m=1,numtotal do
  21.  
  22.  
  23.     cor = cxymsgunser[((m*3)-2)]
  24.     xdot = tonumber(cxymsgunser[((m*3)-1)])
  25.     ydot = tonumber(cxymsgunser[(m*3)])
  26.  
  27.     if cor == "w" then hcor = 0xF0F0F0
  28.     elseif cor == "r" then hcor = 0xB3312C
  29.     elseif cor == "o" then hcor = 0xFFFF55
  30.     elseif cor == "g" then hcor = 0x3B511A
  31.     end
  32.  
  33.     bridge.addBox(xdot+10,ydot+10,2,2,hcor)
  34.  
  35.  
  36.   end
  37.  
  38.   sleep(0.25)
  39.  
  40.  
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement