Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Setup
- mon = peripheral.wrap("back")
- mon.clear()
- local function load()
- local stocks = dofile("/stocks")
- return stocks
- end
- local function loadts()
- local ts = dofile("/ts")
- return ts
- end
- -- How to Invest
- mon.setTextColor(colors.cyan)
- mon.setCursorPos(1,31)
- mon.write("-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-")
- mon.setCursorPos(30,32)
- mon.write("To invest: /pay GriffinHeileYT {Price of Shares} and")
- mon.setCursorPos(30,33)
- mon.write("tell me what stock you would like to invest in.")
- -- Share Worth
- mon.setCursorPos(2,1)
- mon.write("Formula for Share Worth: #.# x 100 + 100")
- mon.setCursorPos(1,2)
- mon.write("-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-")
- -- Stock Colors
- good = colors.green
- bad = colors.red
- still = colors.white
- -- Stocks
- function stock(line, clr, name, abbreviation, sales, totalsales)
- local color
- if sales < 0 then
- color = good
- elseif sales < 0 then
- color = bad
- else
- color = still
- end
- if totalsales < 0 then
- tscolor = good
- elseif totalsales < 0 then
- tscolor = bad
- else
- tscolor = still
- end
- mon.setCursorPos(1,line)
- mon.setTextColor(clr)
- mon.write(name)
- mon.setCursorPos(20,line)
- mon.setTextColor(colors.white)
- mon.write(abbreviation)
- mon.setTextColor(color)
- mon.setCursorPos(30, line)
- -- Sales
- mon.setTextColor(color)
- sales = tostring(sales)
- mon.write(".000")
- if sales ~= "0" then
- mon.setCursorPos(31 - sales:find("%."), line)
- else
- mon.setCursorPos(29, line)
- end
- mon.write(sales)
- sales = tonumber(sales)
- -- Total Sales
- mon.setTextColor(tscolor)
- totalsales = tostring(totalsales)
- mon.write(".000")
- if totalsales ~= "0" then
- mon.setCursorPos(40 - totalsales:find("%."), line)
- else
- mon.setCursorPos(38, line)
- end
- mon.write(totalsales)
- totalsales = tonumber(totalsales)
- end
- local stocks = load()
- local ts = loadts()
- stock(4, colors.white, "IRON", "IRON", stocks.iron, ts.iron)
- stock(5, colors.orange, "GOLD", "GOLD", stocks.gold, ts.gold)
- stock(6, colors.gray, "COAL", "COAL", stocks.coal, ts.coal)
- stock(7, colors.red, "REDSTONE", "RDSN", stocks.redstone, ts.redstone)
- stock(8, colors.cyan, "DIAMOND", "DMND", stocks.diamond, ts.diamond)
- stock(9, colors.lightGray, "ALUMINUM", "ALMN", stocks.aluminum, ts.aluminum)
- stock(10, colors.white, "GLASS", "GLSS", stocks.glass, ts.glass)
- stock(11, colors.cyan, "GELID CRYO", "CRYO", stocks.gelid_cryo, ts.gelid_cryo)
- stock(12, colors.yellow, "SULFUR", "SLFR", stocks.sulfur, ts.sulfur)
- stock(13, colors.lightBlue, "TIN", "TIN", stocks.tin, ts.tin)
- stock(14, colors.lightGray, "QUARTZ DUST", "QRTZ", stocks.quartz_dust, ts.quartz_dust)
- stock(15, colors.lightBlue, "CERTUS QUARTZ", "CQTZ", stocks.certus_quartz, ts.certus_quartz)
- stock(16, colors.purple, "OBSIDIAN", "OBSN", stocks.obsidian, ts.obsidian)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement