Epuuc

Minecraft CC Display Computer

Nov 23rd, 2020 (edited)
3,254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.21 KB | None | 0 0
  1. local modem = peripheral.find("modem")
  2. if not modem then print("Modem required, preferably an ender one") return end
  3. modem.open(99)
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. local monitor = peripheral.wrap("top")
  7. monitor.setTextScale(0.5)
  8. print("Open and listening for logs on channel 99")
  9. while true do
  10.     local ev,side,channel,repchannel,msg,distance = os.pullEvent()
  11.     if ev == "modem_message" and distance ~= 0 then
  12.         print("Frequency:",channel)
  13.         if msg.Title and msg.Body then
  14.             local severity = 1
  15.             if msg.Severity then
  16.                 severity = msg.Severity
  17.             end
  18.             if term.isColor() then
  19.                 local colours = {
  20.                     [1] = colors.white,
  21.                     [2] = colors.orange,
  22.                     [3] = colors.red
  23.                 }
  24.                 term.setTextColor(colours[severity])
  25.             end
  26.             print(msg.Title..":",msg.Body)
  27.             term.setTextColor(colors.white)
  28.         end
  29.         if not msg.Body and not msg.Title then
  30.             print("Invalid Indexes On Message")
  31.         end
  32.     elseif ev == "redstone" then
  33.         redstone.setOutput("left",redstone.getInput("right"))
  34.         if redstone.getInput("right") then
  35.             modem.transmit(99,99,{Title="Tornado",Body="Tornado started at Home Base"})
  36.         else
  37.             modem.transmit(99,99,{Title="Tornado",Body="Tornado ended at Home Base"})
  38.         end
  39.     end
  40. end
  41.  
  42.  
Add Comment
Please, Sign In to add comment