lego11

MonitorQuotazioniGelati

Oct 4th, 2025
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("top")
  2. mon.setTextScale(0.5)
  3. uri = "http://luanet.rgbcraft.com/servlets/vendite/gelati"
  4.  
  5. while true do
  6.     term.redirect(mon)
  7.     function clear()
  8.     term.clear()
  9.     term.setCursorPos(1, 1)
  10.     term.setBackgroundColour(colours.black)
  11.     term.setTextColor( colors.white )
  12.     end
  13.     function link()
  14.     term.setTextColour(colours.yellow)
  15.     end
  16.     function fineLink()
  17.     term.setTextColour(colours.white)
  18.     end
  19.     function colore(sfumatura)
  20.     term.setTextColour(sfumatura)
  21.     end
  22.     function fineColore()
  23.     term.setTextColour(colours.orange)
  24.     end
  25.     function sfondo(sfumaturaSfondo)
  26.     term.setBackgroundColour(sfumaturaSfondo)
  27.     end
  28.     function fineSfondo()
  29.     term.setBackgroundColour(colours.black)
  30.     end
  31.     clear()
  32.     colore(colours.black)
  33.     sfondo(colours.yellow)
  34.     print("FRIGOR NEW RADEON - Vendita ed export gelati             ")
  35.     fineColore()
  36.     fineSfondo()
  37.     quotazioni = textutils.unserialize(http.get(uri.."/?richiesta=prezzario_lua").readAll())
  38.     print("\n")
  39.     colore(colors.black)
  40.     sfondo(colours.orange)
  41.     print("Nome                              Quotaz.        ")
  42.     fineColore()
  43.     fineSfondo()
  44.     ypos = 6
  45.     local i = 0
  46.     for k,v in pairs(quotazioni) do
  47.     if (i % 2 == 0) then
  48.         colore(colors.yellow)
  49.     else
  50.         colore(colors.orange)
  51.     end
  52.         term.setCursorPos(1, ypos)
  53.         term.write(v["nome"])
  54.         term.setCursorPos(36, ypos)
  55.         term.write(v["prezzo"])
  56.         ypos = ypos + 1
  57.         i = i + 1
  58.     end
  59.     colore(colours.yellow)
  60.     term.setCursorPos(1, 18)
  61.     fineColore()
  62.     term.restore()
  63.     sleep(120)
  64. end
Advertisement
Add Comment
Please, Sign In to add comment