SHOW:
|
|
- or go back to the newest paste.
| 1 | - | -- CONFIGURAZIONE |
| 1 | + | printer = peripheral.wrap("right")
|
| 2 | - | -- Lato stampante |
| 2 | + | term.clear() |
| 3 | - | LPT = "right" |
| 3 | + | print(" eRGB")
|
| 4 | print("")
| |
| 5 | - | -- DICHIARAZIONE VARIABILI |
| 5 | + | print("Apertura contratto eRGB")
|
| 6 | - | -- contatori totali |
| 6 | + | print("")
|
| 7 | - | consumoTotale = 0 |
| 7 | + | print("Inserire nome")
|
| 8 | - | immissioneTotale = 0 |
| 8 | + | local nome = read() |
| 9 | print("Inserire cod.cliente")
| |
| 10 | - | cliente = nil |
| 10 | + | local UICnumber = read() |
| 11 | print("")
| |
| 12 | - | -- spese fisse totali |
| 12 | + | print("Inserire tipo contratto")
|
| 13 | - | speseFisseConsTotali = 0 |
| 13 | + | local type = read() |
| 14 | - | speseFisseImmTotali = 0 |
| 14 | + | print("")
|
| 15 | print("Inserire pot. contratt.")
| |
| 16 | - | -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX |
| 16 | + | local power = read() |
| 17 | - | local function drawPixelInternal(xPos, yPos) |
| 17 | + | print("")
|
| 18 | - | term.setCursorPos(xPos, yPos) |
| 18 | + | print("Inserire spesa fissa")
|
| 19 | - | term.write(" ")
|
| 19 | + | local tassa = read() |
| 20 | - | end |
| 20 | + | print("")
|
| 21 | - | local tColourLookup = {}
|
| 21 | + | |
| 22 | - | for n = 1, 16 do |
| 22 | + | |
| 23 | - | tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
|
| 23 | + | |
| 24 | - | end |
| 24 | + | term.clear() |
| 25 | - | function drawFilledBox(startX, startY, endX, endY, nColour) |
| 25 | + | term.setCursorPos(1, 1) |
| 26 | - | if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~= |
| 26 | + | printer.newPage() |
| 27 | - | "number" or type(endY) ~= "number" or |
| 27 | + | printer.setPageTitle("Contratto eRGB")
|
| 28 | - | (nColour ~= nil and type(nColour) ~= "number") then |
| 28 | + | printer.write("Contratto eRGB")
|
| 29 | - | error("Expected startX, startY, endX, endY, colour", 2)
|
| 29 | + | printer.setCursorPos(1, 2) |
| 30 | - | end |
| 30 | + | printer.setCursorPos(1, 4) |
| 31 | printer.write("Intestatario: ")
| |
| 32 | - | startX = math.floor(startX) |
| 32 | + | printer.setCursorPos(15, 4) |
| 33 | - | startY = math.floor(startY) |
| 33 | + | printer.write(nome) |
| 34 | - | endX = math.floor(endX) |
| 34 | + | printer.setCursorPos(1, 6) |
| 35 | - | endY = math.floor(endY) |
| 35 | + | printer.write("Tipologia contratto:")
|
| 36 | printer.setCursorPos(1, 7) | |
| 37 | - | if nColour then term.setBackgroundColor(nColour) end |
| 37 | + | printer.write(type) |
| 38 | - | if startX == endX and startY == endY then |
| 38 | + | printer.setCursorPos(1, 9) |
| 39 | - | drawPixelInternal(startX, startY) |
| 39 | + | printer.write("Potenza contrattuale:")
|
| 40 | - | return |
| 40 | + | printer.setCursorPos(1, 10) |
| 41 | - | end |
| 41 | + | printer.write(power) |
| 42 | printer.setCursorPos(1, 12) | |
| 43 | - | local minX = math.min(startX, endX) |
| 43 | + | printer.write("Spese fisse:")
|
| 44 | - | if minX == startX then |
| 44 | + | printer.setCursorPos(1, 13) |
| 45 | - | minY = startY |
| 45 | + | printer.write(tassa) |
| 46 | - | maxX = endX |
| 46 | + | printer.setCursorPos(4, 13) |
| 47 | - | maxY = endY |
| 47 | + | printer.write("IC")
|
| 48 | - | else |
| 48 | + | printer.setCursorPos(1, 16) |
| 49 | - | minY = endY |
| 49 | + | printer.write("Conservare questo foglio")
|
| 50 | - | maxX = startX |
| 50 | + | printer.setCursorPos(1, 17) |
| 51 | - | maxY = startY |
| 51 | + | printer.write("per future referenze.")
|
| 52 | - | end |
| 52 | + | printer.setCursorPos(1, 18) |
| 53 | printer.write("Grazie per aver scelto")
| |
| 54 | - | for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end |
| 54 | + | printer.setCursorPos(1, 19) |
| 55 | - | end |
| 55 | + | printer.write("eRGB!")
|
| 56 | - | -- Icone |
| 56 | + | printer.endPage() |
| 57 | - | function disegnaAvviso() |
| 57 | + | print("Stampa contratto in corso")
|
| 58 | - | drawFilledBox(5, 6, 13, 13, colours.yellow) |
| 58 | + | print("Ritirare il contratto")
|
| 59 | - | for i = 7, 12, 1 do |
| 59 | + | sleep(2) |