Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Power Monitoring Program Written By: 0_Mr_Redstone_0 AKA MoJoCreatior
- This code is considered free for use both commercial and private and can be redistributed so long as it meats following criteria:
- 1: 0_Mr_Redstone_0 and MoJoCreatior are credited as the original authors
- 2: You do not try to take full ownership of the code/written program
- 3: If you modify the code for re-upload you must provide it under the same conditions. as in- Open Source, and credit me as original author]]
- program = "Power Monitoring Setup V:21"
- --functions
- function intro()
- term.setBackgroundColour(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColour(colors.green)
- print(program.." -Written By: 0_Mr_Redstone_0 AKA MoJoCreatior\n")
- term.setTextColour(colors.orange)
- print("Hold 'CTRL+R' to start over\n")
- end
- function setup(question,file,binary,subText)
- term.setBackgroundColour(colors.white)
- term.clear()
- intro()
- term.setTextColour(colors.gray)
- print(question)
- if binary == 1 then
- term.setTextColour(colors.lightGray)
- print(subText)
- end
- term.setTextColour(colors.cyan)
- fs.delete("config/"..file)
- cfg = fs.open("config/"..file,"w")
- answer = io.read()
- cfg.write(answer)
- cfg.close()
- end
- function setupSub(question,file,binary,subText)
- term.setTextColour(colors.gray)
- print(question)
- if binary == 1 then
- term.setTextColour(colors.lightGray)
- print(subText)
- end
- term.setTextColour(colors.cyan)
- fs.delete("config/"..file)
- cfg = fs.open("config/"..file,"w")
- answer = io.read()
- cfg.write(answer)
- cfg.close()
- end
- function update()
- fs.delete("startup")
- startup = fs.open("startup","w")
- startup.write("shell.run('install.lua')")
- startup.close()
- end
- function config(name)
- cfg = fs.open("config/"..name,"r")
- name = cfg.readAll()
- cfg.close()
- return name
- end
- function configSave(name,data)
- cfg = fs.open("config/"..name,"w")
- cfg.write(data)
- cfg.close()
- end
- --Setup
- if not fs.exists("install.lua") then shell.run("pastebin get 9b6m3ym1 install.lua") end
- intro()
- if fs.exists("config/update") then setup("Do you want to Update?","update",1," [y/n]") updateV = answer end
- configSave("update","true")
- if updateV == "y" then update() os.reboot() end
- setup("Would you like Advanced Options?","options",1,"[y/n]\n Allows you to set Custom Colors")
- setup("What do you want the Title to be?","title",1,"Titles will appear off screen if made too long")
- if config("options") == "y" then
- setupSub("\nWhat color should the Titles Background be?","colorTB",1," Case Sensitive")
- setupSub("\nWhat color should the Titles Text be?","colorTT",1," Case Sensitive")
- setup("What color should the Monitor Background be?","colorMB",1," Case Sensitive")
- setupSub("\nWhat color should the Energy Statistics be?","colorST",1," Case Sensitive")
- setupSub("\nWhat color should the Empty Bar be?","colorBE",1," Case Sensitive")
- setupSub("\nWhat color should the Filled Bar be?","colorBF",1," Case Sensitive")
- setupSub("\nWhat color should the % Filled be?","colorBT",1," Case Sensitive")
- setupSub("\nWhat color should positive change be?","colorPos",1," Case Sensitive")
- setupSub("\nWhat color should negative change be?","colorNeg",1," Case Sensitive")
- setupSub("\nWhat color should negative change be?","colorNeg",1," Case Sensitive")
- else
- configSave("colorTB","black")
- configSave("colorTT","white")
- configSave("colorMB","white")
- configSave("colorST","blue")
- configSave("colorBE","gray")
- configSave("colorBF","lime")
- configSave("colorBT","cyan")
- configSave("colorPos","green")
- configSave("colorNeg","red")
- end
- setup("Would you like to enable Redstone Output?","redstone",1," [y/n]")
- if config("redstone") == "y" then
- setupSub("Are you using -1-Project:Red Bundled Cable or -2-Vanilla Redstone?","bundled",1," [1/2]\n You can choose Bundled Cable Color\n as well the side the output is on")
- setupSub("What side of the computer should the output be on?","side",1," right,left,front,back,top,bottom")
- if config("bundled") == "1" then
- setupSub("What color cable should the output be on?","colorPR",1," Case Sensitive")
- else configSave("colorPR","0")
- end
- else
- configSave("bundled","0")
- configSave("side","0")
- configSave("colorPR","0")
- end
- setup("Should the Monitor Refresh be fast or slow?","rate",1," [f/s]\n fast is every 1 second\n slow is every 5 seconds")
- setup("How many RF storage do you have?","storage", 1, "How much rf does your storage have?")
- setup("Would you like Dynamic Text Scaling to be turned on?","dynamic",1,"[y/n]\n Makes Text Scaling update as\n you Change the monitor size")
- intro()
- print("Auto Restart in 3 seconds!") sleep(1)
- print("Auto Restart in 2 seconds!") sleep(1)
- print("Auto Restart in 1 seconds!") sleep(1)
- print("Restarting...")
- startup = fs.open("startup","w")
- startup.write('shell.run("program.lua")')
- startup.close()
- os.reboot()
Add Comment
Please, Sign In to add comment