Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local totalEconomy = tArgs[1]
- local expenses = 0
- print("Calculating your economy..")
- for k,v in ipairs(tArgs) do
- if k >= 2 then
- expenses = expenses + v
- end
- if k == 1 and v == "update" then
- data = http.get("https://www.dropbox.com/s/0hhlsnfr7lmdv1v/economy?dl=1")
- file = fs.open(shell.getRunningProgram(),"w")
- file.write(data.readAll())
- file.close()
- data.close()
- print("Updated Economy!")
- print("Rebooting.")
- startupData = fs.open("startup","w")
- newData = [[
- print("Economy was updated successfully.")
- print("You can now use it with the following command:")
- print("economy <total income> <expense> <expense> <exense> . . .")
- fs.delete("startup")
- ]]
- startupData.write(newData)
- startupData.close()
- os.reboot()
- end
- end
- sleep(0.5)
- local profit = (tonumber(totalEconomy) - expenses)
- print("Expenses: "..expenses)
- print("Income:"..totalEconomy)
- if profit > 500 then
- term.setTextColor(colors.green)
- print("Budget:"..profit)
- else
- term.setTextColor(colors.red)
- print("Budget:"..profit)
- end
- term.setTextColor(colors.white)
- if profit >= 1000 or tonumber(totalEconomy) >= expenses then
- print("Economy is in good standing!")
- else
- print("Problems:")
- if profit <= 1000 then
- print("- Budget is dangerously low.")
- end
- if tonumber(totalEconomy) < expenses then
- print("- Expenses are larger than your income!")
- end
- --print("Economy needs work.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement