Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---V1----
- rednet.open("top")
- m = peripheral.wrap("right")
- Sx, Sy = m.getSize()
- m.clear()
- local function Calcul(X, Y)
- return X-4, Y-2
- end
- local function Affichage(Cell_name, numcell, Verite)
- if type(Cell_name) ~= "string" then error("Invalide str") return end
- if numcell < 1 then error("Invalide numero cell") return end
- local Sx_u, Sy_u = Calcul(Sx,Sy)
- if i == 1 then
- m.setTextColor(colors.white)
- m.setCursorPos(Sx - Sx_u,Sy - Sy_u)
- m.write("Cell "..Cell_name..":")
- if Verite then
- m.setCursorPos(Sx - Sx_u + 9,Sy - Sy_u)
- m.setTextColor(colors.green)
- m.write("HIGH")
- end
- else
- m.setTextColor(colors.white)
- m.setCursorPos(Sx - Sx_u,Sy-Sy_u+numcell-1)
- m.write("Cell "..Cell_name..":")
- if Verite then
- m.setCursorPos(Sx - Sx_u + 9,Sy-Sy_u+numcell-1)
- m.setTextColor(colors.green)
- m.write("HIGH")
- end
- end
- end
- local function Activate(numcell, msg_red, msg_sh,msg_shok,Valeur)
- local Sx_u, Sy_u = Calcul(Sx,Sy)
- if msg_red == msg_sh or Valeur == msg_sh then
- if numcell == 1 then
- m.setCursorPos(Sx - Sx_u + 9,Sy - Sy_u)
- else
- m.setCursorPos(Sx - Sx_u + 9,Sy - Sy_u+numcell-1)
- end
- m.setTextColor(colors.red)
- m.write("LOW")
- return false
- elseif msg_red == msg_shok or Valeur == msg_shok then
- return true
- else
- return true
- end
- end
- m.clear()
- Affichage("AE",1, true)
- Affichage("Eg",2,true)
- local V_A, V_E = ""
- while true do
- local event, Sendid, msg = os.pullEvent("rednet_message")
- m.clear()
- if msg == "LowBat_AE" or msg == "Ok_AE" then V_A = msg end
- if msg == "LowBat_Eg" or msg == "Ok_Eg" then V_E = msg end
- Affichage("AE",1,Activate(1,msg,"LowBat_AE","Ok_AE",V_A))
- Affichage("Eg",2,Activate(2,msg,"LowBat_Eg","OK_Eg",V_E))
- end
Add Comment
Please, Sign In to add comment