Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- local Archi,BW,Gau = colors.purple, colors.orange, colors.yellow
- while true do
- event, ID,message, distance = os.pullEvent("rednet_message")
- if ( string.sub(message,1,4) == "rail" ) then
- local value = tonumber(string.sub(message,5))
- local newColor = 0
- if ( bit.band(value, 1) ~= 0 ) then newColor = colors.combine(newColor,Archi) end
- if ( bit.band(value, 2) ~= 0 ) then newColor = colors.combine(newColor,BW) end
- if ( bit.band(value, 4) ~= 0 ) then newColor = colors.combine(newColor,Gau) end
- rs.setBundledOutput("back",newColor)
- end
- if ( message == "ping" ) then
- os.sleep(1)
- local myColors = rs.getBundledOutput("back")
- local value = 0
- if colors.test(myColors,Archi) then value = value + 1 end
- if colors.test(myColors,BW) then value = value + 2 end
- if colors.test(myColors,Gau) then value = value + 4 end
- rednet.send(ID,"rail" .. value)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement