Advertisement
Guest User

onscreen

a guest
Jun 27th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.41 KB | None | 0 0
  1. local perilist=peripheral.getNames()
  2. ok,err = pcall("unloadAPI")
  3. local users = {1126}
  4. function unloadAPI()
  5.   os.unloadAPI("zedlib")
  6. end
  7. os.loadAPI("zedlib")
  8. function main()
  9.   rednet.open("right")
  10.   for k,v in pairs(perilist) do
  11.     if peripheral.getType(v) == "monitor" then
  12.       local tmp = peripheral.wrap(v)
  13.       tmp.setTextScale(2)
  14.       local sa,sb = tmp.getSize()
  15.       tmp.setCursorPos(1,sb)
  16.       tmp.setBackgroundColor(colors.white)
  17.       tmp.setTextColor(colors.red)
  18.       tmp.clear()
  19.       tmp.write("The Legion")
  20.     end
  21.   end
  22.   while true do
  23.     for k,v in pairs(users) do
  24.         rednet.send(v,"200")
  25.     end
  26.     term.redirect(term.native())
  27.     fileon = false
  28.     local s,msg,p = rednet.receive(5)
  29.     if (s == 1126) then
  30.       if msg == "file" then
  31.         for k,v in pairs(users) do
  32.           rednet.send(v,"query")
  33.         end
  34.         local s,msg,p = rednet.receive()
  35.         fileon = true
  36.         if (s == 1126) then
  37.           fime = msg
  38.         end
  39.       elseif msg == "clear" then
  40.         for k,v in pairs(perilist) do
  41.           if peripheral.getType(v) == "monitor" then
  42.             local tmp = peripheral.wrap(v)
  43.             tmp.setTextScale(2)
  44.             local sa,sb = tmp.getSize()
  45.             tmp.setCursorPos(1,sb)
  46.             tmp.setBackgroundColor(colors.white)
  47.             tmp.setTextColor(colors.red)
  48.             tmp.clear()
  49.             tmp.write("The Legion")
  50.           end
  51.         end
  52.       elseif msg == "reboot" then
  53.         os.reboot()
  54.       end
  55.       local zbert = 0
  56.       for k,v in pairs(perilist) do
  57.         if peripheral.getType(v) == "monitor" then
  58.           zbert = zbert + 1
  59.           if msg ~= "clear" then
  60.             local tmp = peripheral.wrap(v)
  61.             tmp.setTextScale(3)
  62.             tmp.setBackgroundColor(colors.red)
  63.             tmp.setTextColor(colors.white)
  64.             tmp.setCursorPos(1,1)
  65.             tmp.clear()
  66.             tmp = ""
  67.             term.redirect(peripheral.wrap(v))
  68.             if fileon == true then
  69.               f = fs.open(fime,"r")
  70.               local msgtable = f.readAll()
  71.               f.close()
  72.               print(msgtable)
  73.             else
  74.               print(msg)
  75.             end
  76.           else
  77.             print("Bonjour")
  78.           end
  79.         end
  80.       end
  81.       if zbert == 0 then
  82.         error("NO SCREENS WERE DETECTED")
  83.       end
  84.     else
  85.       print("garbage")
  86.     end
  87.   end
  88. end
  89. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement