Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Header
- function clear()
- term.clear()
- term.setCursorPos(1, 1)
- term.setBackgroundColour(colours.black)
- term.setTextColor( colors.white )
- end
- clear()
- function link()
- term.setTextColour(colours.yellow)
- end
- function fineLink()
- term.setTextColour(colours.white)
- end
- function colore(sfumatura)
- term.setTextColour(sfumatura)
- end
- function fineColore()
- term.setTextColour(colours.white)
- end
- function sfondo(sfumaturaSfondo)
- term.setBackgroundColour(sfumaturaSfondo)
- end
- function fineSfondo()
- term.setBackgroundColour(colours.black)
- end
- function errore()
- while true do
- clear()
- colore(colours.red)
- sfondo(colours.yellow)
- print("Errore!")
- fineSfondo()
- print("")
- print("Errore: Impossibile caricare la pagina!")
- fineColore()
- print("")
- print("Cause comuni:")
- print("")
- print("- Nessuna connessione a LeNet")
- print("- Pagina inesistente")
- print("- Errore di digitazione dell'indirizzo")
- print("- Link errato o obsoleto.")
- print("")
- print("Premere G per navigare ad un'altra pagina")
- print("Premere Q per uscire da LeNet")
- event, key = os.pullEvent("key")
- if key == keys.g then
- vai_a()
- elseif key == keys.q then
- os.reboot()
- end
- end
- end
- function vai_a_url(url)
- clear()
- ln = http.get("http://172.16.20.220/luanet/"..url..".lua")
- if ln == nil or ln == '' then
- errore()
- end
- pagina = loadstring(ln.readAll())
- ln.close()
- pagina()
- if key == keys.g then
- vai_a()
- end
- end
- function vai_a()
- sleep(0.2)
- end
- --inizio pagina
- colore(colours.black)
- sfondo(colours.yellow)
- print("Compagnia Elettrica eRGB")
- fineSfondo()
- fineColore()
- print("")
- term.write("e")
- colore(colours.red)
- term.write("R")
- colore(colours.lime)
- term.write("G")
- colore(colours.lightBlue)
- term.write("B")
- fineColore()
- print("\n")
- print("Benvenuti sul sito di eRGB. Siamo la più grande")
- print("compagnia elettrica di tutta la Nazione.")
- print("")
- print("Operiamo in oltre 20 città e comunità rurali e")
- print("pensiamo sempre al futuro e all'innovazione.")
- print("")
- link()
- print("- Rete elettrica")
- fineLink()
- link()
- print("- Centrali elettriche")
- fineLink()
- link()
- print("- Contratti")
- fineLink()
- link()
- print("- Tariffe")
- fineLink()
- link()
- print("- Pagamenti")
- fineLink()
- -- Fine pagina
- term.setCursorPos(1, 19)
- term.write("Premere G per andare ad un indirizzo, Q per uscire")
- --Eventi per i link
- while true do
- event, key, x, y = os.pullEvent()
- if event == "mouse_click" and y == 11 then
- vai_a_url("ergb/rete")
- elseif event == "mouse_click" and y == 12 then
- vai_a_url("ergb/centrali")
- elseif event == "mouse_click" and y == 13 then
- vai_a_url("ergb/contratti")
- elseif event == "mouse_click" and y == 14 then
- vai_a_url("ergb/tariffe")
- elseif event == "mouse_click" and y == 15 then
- vai_a_url("ergb/pagamenti")
- elseif event == "key" then
- elseif key == keys.q then
- os.reboot()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement