Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RGR - Tabellone partenze (e in futuro arrivi) treni alla stazione
- -- (C) 2026 interSex S.p.A.
- -- Variabili da popolare
- screen_side = "back"
- station_name = "Karabash"
- station_code = "S0068"
- -- Recupero periferiche
- screen = peripheral.wrap(screen_side)
- -- Verifichiamo le specifiche
- width, height = screen.getSize()
- if width < 100 then
- print("DIMENSIONI TROPPO PICCOLE!")
- exit()
- end
- if height < 20 then
- print("DIMENSIONI TROPPO PICCOLE! (y)")
- exit()
- end
- -- Definizione funzioni (copiate da lego11 obv)
- function clear()
- screen.clear()
- screen.setCursorPos(1, 1)
- end
- function clearRed()
- sfondo(colors.red)
- screen.clear()
- screen.setCursorPos(1, 1)
- end
- function colore(sfumatura)
- screen.setTextColour(sfumatura)
- end
- function sfondo(sfumaturaSfondo)
- screen.setBackgroundColour(sfumaturaSfondo)
- end
- function fineColore()
- screen.setTextColour(colours.white)
- end
- function fineSfondo()
- screen.setBackgroundColour(colours.black)
- end
- -- IMPLEMENTAZIONE DEL DRAWFILLEDBOX
- local function drawPixelInternal(xPos, yPos)
- screen.setCursorPos(xPos, yPos)
- screen.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
- screen.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 titolo(testo)
- drawFilledBox(1, 1, width, 1, colors.yellow)
- screen.setCursorPos((width - #testo) / 2, 1)
- colore(colors.black)
- screen.write(testo)
- sfondo(colors.lightBlue)
- end
- while true do
- -- Richiediamo i dati
- local data = textutils.unserialize(http.get("http://172.16.23.169:6009/api/cc/tabellone.php?station="..station_code))
- titolo(station_name.." - Partenze")
- screen.print(data)
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment