Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open('back')
- local monitorScan = {peripheral.find('monitor')}
- local speakers = {peripheral.find('speaker')}
- local idr = 14
- local monitors={}
- local monitorList={'6','7'}
- for i,v in pairs(monitorScan) do
- local isValid = false
- for ii,vv in pairs(monitorList) do
- if peripheral.getName(v)==('monitor_'..vv) then
- isValid=true
- end
- end
- if isValid then
- table.insert(monitors,v)
- end
- end
- for i,v in pairs(monitors) do
- v.setTextScale(0.5)
- v.setBackgroundColor(colors.black)
- v.clear()
- end
- function drawScreen(monitor,image)
- local oldTerm = term.redirect(monitor)
- paintutils.drawImage(image,5,4)
- term.redirect(oldTerm)
- end
- function playNote(speaker,details)
- speaker.playNote(details[1],details[2])
- end
- while true do
- local id,data,type=rednet.receive()
- if id == idr and data and type then
- if type == '0' then
- for i,v in pairs(monitors) do
- drawScreen(v,data)
- end
- elseif type == '1' then
- for i,v in pairs(speakers) do
- playNote(v,data)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement