Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- -- LUL
- maxw, maxh = term.getSize()
- local function drawPixelInternal(xPos, yPos)
- term.setCursorPos(xPos, yPos)
- term.write(" ")
- end
- local tColourLookup = {}
- for n = 1, 16 do
- tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
- end
- function drawFilledBox(startX, startY, endX, endY, nColour)
- if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
- "number" or type(endY) ~= "number" or
- (nColour ~= nil and type(nColour) ~= "number") then
- error("Expected startX, startY, endX, endY, colour", 2)
- end
- startX = math.floor(startX)
- startY = math.floor(startY)
- endX = math.floor(endX)
- endY = math.floor(endY)
- if nColour then term.setBackgroundColor(nColour) end
- if startX == endX and startY == endY then
- drawPixelInternal(startX, startY)
- return
- end
- local minX = math.min(startX, endX)
- if minX == startX then
- minY = startY
- maxX = endX
- maxY = endY
- else
- minY = endY
- maxX = startX
- maxY = startY
- end
- for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
- end
- function clear()
- sfondo(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function clearRed()
- sfondo(colors.red)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.blue)
- term.setCursorPos((maxw - #testo) / 2, 1)
- term.setTextColor(colors.white)
- term.write(testo)
- end
- function alarm(testo, colore, y)
- drawFilledBox(1, y, maxw, y, colors[colore])
- term.setCursorPos((maxw - #testo) / 2, y)
- term.setTextColor(colors.white)
- term.write(testo)
- no()
- end
- function bottone(color, text, x, y)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- end
- function no()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- end
- p = peripheral.wrap("bottom")
- while true do
- local a, b, c, b1 = p.get(1)
- b1 = b1.energyL
- local a, b, c, b2 = p.get(2)
- b2 = b2.energyL
- local a, b, c, b3 = p.get(3)
- b3 = b3.energyL
- local a, b, c, b4 = p.get(4)
- b4 = b4.energyL
- local a, b, c, b5 = p.get(5)
- b5 = b5.energyL
- local a, b, c, b6 = p.get(6)
- b6 = b6.energyL
- if b1 < 500000 then
- color1 = "red"
- text1 = "Low Power"
- elseif b1 < 1000000 then
- color1 = "orange"
- text1 = "Low Power"
- elseif b1 < 5000000 then
- color1 = "yellow"
- text1 = "Good Power"
- elseif b1 > 7500000 then
- color1 = "green"
- text1 = "Wonderful Power"
- else
- color1 = "gray"
- text1 = "ERROR"
- end
- if b2 < 500000 then
- color2 = "red"
- text2 = "Low Power"
- elseif b2 < 1000000 then
- color2 = "orange"
- text2 = "Low Power"
- elseif b2 < 5000000 then
- color2 = "yellow"
- text2 = "Good Power"
- elseif b2 > 7500000 then
- color2 = "green"
- text2 = "Wonderful Power"
- else
- color2 = "gray"
- text2 = "ERROR"
- end
- if b3 < 500000 then
- color3 = "red"
- text3 = "Low Power"
- elseif b1 < 1000000 then
- color3 = "orange"
- text3 = "Low Power"
- elseif b3 < 5000000 then
- color3 = "yellow"
- text3 = "Good Power"
- elseif b3 > 7500000 then
- color3 = "green"
- text3 = "Wonderful Power"
- else
- color3 = "gray"
- text3 = "ERROR"
- end
- if b4 < 500000 then
- color4 = "red"
- text4 = "Low Power"
- elseif b4 < 1000000 then
- color4 = "orange"
- text4 = "Low Power"
- elseif b4 < 5000000 then
- color4 = "yellow"
- text4 = "Good Power"
- elseif b4 > 7500000 then
- color4 = "green"
- text4 = "Wonderful Power"
- else
- color4 = "gray"
- text4 = "ERROR"
- end
- if b5 < 500000 then
- color5 = "red"
- text5 = "Low Power"
- elseif b5 < 1000000 then
- color5 = "orange"
- text5 = "Low Power"
- elseif b5 < 5000000 then
- color5 = "yellow"
- text5 = "Good Power"
- elseif b5 > 7500000 then
- color5 = "green"
- text5 = "Wonderful Power"
- else
- color5 = "gray"
- text5 = "ERROR"
- end
- if b6 < 500000 then
- color6 = "red"
- text6 = "Low Power"
- elseif b6 < 1000000 then
- color6 = "orange"
- text6 = "Low Power"
- elseif b6 < 5000000 then
- color6 = "yellow"
- text6 = "Good Power"
- elseif b6 > 7500000 then
- color6 = "green"
- text6 = "Wonderful Power"
- else
- color6 = "gray"
- text6 = "ERROR"
- end
- term.setBackgroundColor(colors.white)
- term.clear()
- titolo("Gestione Batterie - Titanus Elios")
- no()
- print("\nBenvenuto nel centro di gestione delle batterie di Emergenza!")
- term.setCursorPos(2, 4)
- print("Batteria 1")
- term.setCursorPos(4, 5)
- term.setBackgroundColor(colors[color1])
- print(" ")
- no()
- print(text1)
- sleep(0.1)
- end
Add Comment
Please, Sign In to add comment