Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Side = { "bottom", "top", "back", "left", "right" }
- for i = 1,5 do
- print(Side[i].." : "..tostring(peripheral.getType(Side[i])))
- if peripheral.getType(Side[i]) == "modem" then
- modem = peripheral.wrap(Side[i])
- print("Using modem at "..Side[i])
- break
- end
- end
- if modem == nil then
- error("No modem found!")
- end
- peripherals = modem.getNamesRemote()
- monitors = {}
- function FindMonitors ()
- counter = 1
- for i = 1, #peripherals do
- if modem.getTypeRemote(peripherals[i]) == "monitor" then
- monitors[counter] = peripherals[i]
- counter = counter+1
- end
- end
- if (table.getn(monitors)==0) then
- error("No monitors present!")
- end
- print(tostring(table.getn(monitors)).." monitors found")
- end
- function printAtAll(text)
- for key,val in pairs(monitors) do
- modem.callRemote(val, "write", text.."\n")
- end
- end
- FindMonitors()
- printAtAll("Hello, world!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement