Advertisement
Guest User

startup

a guest
Apr 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. -- Setup
  2. mon = peripheral.wrap("back")
  3. mon.clear()
  4.  
  5. local function load()
  6.   local file = io.open("sharePrices.stocks")
  7.   local stocks = textutils.unserialize(file.readAll())
  8.   file.close()
  9.   return stocks
  10. end
  11. -- How to Invest
  12. mon.setTextColor(colors.cyan)
  13. mon.setCursorPos(1,31)
  14. mon.write("-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-")
  15. mon.setCursorPos(30,32)
  16. mon.write("To invest: /pay GriffinHeileYT {Price of Shares} and")
  17. mon.setCursorPos(30,33)
  18. mon.write("tell me what stock you would like to invest in.")
  19.  
  20. -- Share Worth
  21. mon.setCursorPos(2,1)
  22. mon.write("Formula for Share Worth: #.# x 100 + 100")
  23. mon.setCursorPos(1,2)
  24. mon.write("-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-")
  25.  
  26. -- Stock Colors
  27. good = colors.green
  28. bad = colors.red
  29. still = colors.white
  30. function color(clr)
  31.      mon.setTextColor(clr)
  32. end
  33.  
  34. -- Stocks
  35. function stock(line, clr, name, abbreviation, performance, sales)
  36.      mon.setCursorPos(1,line)
  37.      mon.setTextColor(clr)
  38.      mon.write(name)
  39.      mon.setCursorPos(15,line)
  40.      mon.setTextColor(colors.white)
  41.      mon.write(abbreviation)
  42.      mon.setTextColor(clr)
  43.      mon.setCursorPos(20, line)
  44.   mon.setTextColor(performance)
  45.      mon.write(sales)
  46. end
  47.  
  48. stock(4, colors.white, "IRON", "IRON", good, stocks.iron)
  49. stock(5, colors.orange, "GOLD", "GOLD", good, "0.100")
  50. stock(6, colors.gray, "COAL", "COAL", bad, "-0.100")
  51. stock(7, colors.red, "REDSTONE", "RDSN", good, "0.100")
  52. stock(8, colors.cyan, "DIAMOND", "DMND", still, "0.000")
  53. stock(9, colors.lightGray, "ALUMINUM", "ALMN", good, "0.10")
  54. stock(10, colors.white, "GLASS", "GLSS", good, "1.05")
  55. stock(11, colors.cyan, "GELID CRYO", "CRYO", good, "0.3")
  56. stock(12, colors.yellow, "SULFUR", "SLFR", bad, "-0.100")
  57. stock(13, colors.lightBlue, "TIN", "TIN", bad, "-0.100")
  58. stock(14, colors.lightGray, "QUARTZ DUST", "QRTZ", still, "0.000")
  59. stock(15, colors.lightBlue, "CERTUS QUARTZ", "CQTZ", still, "0.000")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement