lego11

BorsaTyrianMonitor

Dec 15th, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("right")
  2. term.redirect(mon)
  3. while true do
  4. function clear()
  5. term.clear()
  6. term.setCursorPos(1, 1)
  7. term.setBackgroundColour(colours.black)
  8. term.setTextColor( colors.white )
  9. end
  10. function link()
  11. term.setTextColour(colours.yellow)
  12. end
  13. function fineLink()
  14. term.setTextColour(colours.white)
  15. end
  16. function colore(sfumatura)
  17. term.setTextColour(sfumatura)
  18. end
  19. function fineColore()
  20. term.setTextColour(colours.white)
  21. end
  22. function sfondo(sfumaturaSfondo)
  23. term.setBackgroundColour(sfumaturaSfondo)
  24. end
  25. function fineSfondo()
  26. term.setBackgroundColour(colours.black)
  27. end
  28. clear()
  29. colore(colours.black)
  30. sfondo(colours.yellow)
  31. print("BORSA DI KILMAURS | QUOTAZIONI")
  32. fineColore()
  33. fineSfondo()
  34. quotazioni = textutils.unserialize(http.get("http://rest.rgbcraft.com/borsakilmaurs/?richiesta=lua_totale").readAll())
  35. colore(colors.purple)
  36. print("\nSimb Nome societåA0                  Quotaz.   Scost.")
  37. fineColore()
  38. ypos = 4
  39. for k,v in pairs(quotazioni) do
  40.     term.setCursorPos(1, ypos)
  41.     term.write(k)
  42.     term.setCursorPos(6, ypos)
  43.     term.write(v["nome"])
  44.     term.setCursorPos(36, ypos)
  45.     term.write(v["quotazione"])
  46.     term.setCursorPos(46, ypos)
  47.     if v["segno"] == "+" then
  48.         colore(colors.lime)
  49.     else
  50.         colore(colors.red)
  51.     end
  52.     term.write(v["scarto"])
  53.     fineColore()
  54.     ypos = ypos + 1
  55. end
  56. colore(colours.yellow)
  57. term.setCursorPos(1, 18)
  58. fineColore()
  59. sleep(120)
  60. end
Add Comment
Please, Sign In to add comment