Advertisement
geremy44

Monitor 1.7.10

Feb 9th, 2022 (edited)
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.56 KB | None | 0 0
  1. --ID : 2
  2. local mon = peripheral.wrap("back")
  3. local i = 0
  4. rednet.open("right")
  5. mon.setTextScale(1)
  6. mon.clear()
  7. mon.setTextColor(colors.black)
  8. mon.setCursorPos(2,4)
  9. mon.setBackgroundColor(colors.green)
  10. mon.write("      ")
  11. mon.setCursorPos(2,5)
  12. mon.setBackgroundColor(colors.green)
  13. mon.write("  On  ")
  14. mon.setCursorPos(2,6)
  15. mon.setBackgroundColor(colors.green)
  16. mon.write("      ")
  17. mon.setCursorPos(10,4)
  18. mon.setBackgroundColor(colors.red)
  19. mon.write("        ")
  20. mon.setCursorPos(10,5)
  21. mon.setBackgroundColor(colors.red)
  22. mon.write("  Auto  ")
  23. mon.setCursorPos(10,6)
  24. mon.setBackgroundColor(colors.red)
  25. mon.write("        ")
  26. mon.setBackgroundColor(colors.black)
  27. while true do
  28.     local event, side, sCh, rCh, msg, dist = os.pullEvent()
  29.     if event == "modem_message" then
  30.         local ID, Message, Protocole = rednet.receive()
  31.         if (Protocole == "Etat") and (Message == "On") then
  32.             mon.setCursorPos(1,1)
  33.             mon.write("                                        ")
  34.             mon.setCursorPos(1,1)
  35.             mon.setTextColor(colors.green)
  36.             mon.write("Reacteur On")
  37.         elseif (Protocole == "Etat") and (Message == "Off") then
  38.             mon.setCursorPos(1,1)
  39.             mon.write("                                        ")
  40.             mon.setCursorPos(1,1)
  41.             mon.setTextColor(colors.red)
  42.             mon.write("Reacteur Off")
  43.         end
  44.         if (Protocole == "Prod") then
  45.             mon.setCursorPos(1,2)
  46.             mon.write("                                        ")
  47.             mon.setCursorPos(1,2)
  48.             mon.setTextColor(colors.orange)
  49.             mon.write("Production :"..Message.." RF/t")
  50.         end
  51.         if (Protocole == "Stor") then
  52.             mon.setCursorPos(1,3)
  53.             mon.write("                                        ")
  54.             mon.setCursorPos(1,3)
  55.             mon.setTextColor(colors.magenta)
  56.             mon.write("Stoquage :"..Message.." RF")
  57.         end
  58.         if (ID == 4) and (Message == "Auto") then
  59.             i = 0
  60.         elseif (ID == 4) and (Message == "Man") then
  61.             i = 1
  62.         end
  63.     end
  64.     if i == 0 then
  65.             mon.setCursorPos(14,1)
  66.             mon.setTextColor(colors.yellow)
  67.             mon.write("             ")
  68.             mon.setCursorPos(14,1)
  69.             mon.write("Mode : Auto")
  70.         else
  71.             mon.setCursorPos(14,1)
  72.             mon.setTextColor(colors.yellow)
  73.             mon.write("             ")
  74.             mon.setCursorPos(14,1)
  75.             mon.write("Mode : Active")
  76.         end
  77. end
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement