yoyoyyoghurtboyyyy

Untitled

Nov 22nd, 2021 (edited)
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[  Power Monitoring Program Written By: 0_Mr_Redstone_0  AKA  MoJoCreatior
  2. This code is considered free for use both commercial and private and can be redistributed so long as it meats following criteria:
  3. 1: 0_Mr_Redstone_0 and MoJoCreatior are credited as the original authors
  4. 2: You do not try to take full ownership of the code/written program
  5. 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]]
  6.  
  7. program = "Power Monitoring Setup V:21"
  8.  
  9. --functions
  10.   function intro()
  11.     term.setBackgroundColour(colors.white)
  12.     term.clear()
  13.     term.setCursorPos(1,1)
  14.     term.setTextColour(colors.green)
  15.     print(program.." -Written By: 0_Mr_Redstone_0  AKA  MoJoCreatior\n")
  16.     term.setTextColour(colors.orange)
  17.     print("Hold 'CTRL+R' to start over\n")
  18.   end
  19.  
  20.   function setup(question,file,binary,subText)
  21.     term.setBackgroundColour(colors.white)
  22.     term.clear()
  23.     intro()
  24.     term.setTextColour(colors.gray)
  25.     print(question)
  26.     if binary == 1 then
  27.       term.setTextColour(colors.lightGray)
  28.       print(subText)
  29.     end
  30.     term.setTextColour(colors.cyan)
  31.     fs.delete("config/"..file)
  32.     cfg = fs.open("config/"..file,"w")
  33.     answer = io.read()
  34.     cfg.write(answer)
  35.     cfg.close()
  36.   end
  37.  
  38.   function setupSub(question,file,binary,subText)
  39.     term.setTextColour(colors.gray)
  40.     print(question)
  41.     if binary == 1 then
  42.       term.setTextColour(colors.lightGray)
  43.       print(subText)
  44.     end
  45.     term.setTextColour(colors.cyan)
  46.     fs.delete("config/"..file)
  47.     cfg = fs.open("config/"..file,"w")
  48.     answer = io.read()
  49.     cfg.write(answer)
  50.     cfg.close()
  51.   end
  52.  
  53.   function update()
  54.     fs.delete("startup")
  55.     startup = fs.open("startup","w")
  56.     startup.write("shell.run('install.lua')")
  57.     startup.close()
  58.   end
  59.  
  60.   function config(name)
  61.     cfg = fs.open("config/"..name,"r")
  62.     name = cfg.readAll()
  63.     cfg.close()
  64.     return name
  65.   end
  66.  
  67.   function configSave(name,data)
  68.     cfg = fs.open("config/"..name,"w")
  69.     cfg.write(data)
  70.     cfg.close()
  71.   end
  72.  
  73. --Setup
  74.   if not fs.exists("install.lua") then shell.run("pastebin get 9b6m3ym1 install.lua") end
  75.   intro()
  76.   if fs.exists("config/update") then setup("Do you want to Update?","update",1," [y/n]") updateV = answer end
  77.     configSave("update","true")
  78.     if updateV == "y" then update() os.reboot() end
  79.    
  80.   setup("Would you like Advanced Options?","options",1,"[y/n]\n Allows you to set Custom Colors")
  81.   setup("What do you want the Title to be?","title",1,"Titles will appear off screen if made too long")
  82.   if config("options") == "y" then
  83.     setupSub("\nWhat color should the Titles Background be?","colorTB",1," Case Sensitive")
  84.     setupSub("\nWhat color should the Titles Text be?","colorTT",1," Case Sensitive")
  85.     setup("What color should the Monitor Background be?","colorMB",1," Case Sensitive")
  86.     setupSub("\nWhat color should the Energy Statistics be?","colorST",1," Case Sensitive")
  87.     setupSub("\nWhat color should the Empty Bar be?","colorBE",1," Case Sensitive")
  88.     setupSub("\nWhat color should the Filled Bar be?","colorBF",1," Case Sensitive")
  89.     setupSub("\nWhat color should the % Filled be?","colorBT",1," Case Sensitive")
  90.     setupSub("\nWhat color should positive change be?","colorPos",1," Case Sensitive")
  91.     setupSub("\nWhat color should negative change be?","colorNeg",1," Case Sensitive")
  92.     setupSub("\nWhat color should negative change be?","colorNeg",1," Case Sensitive")
  93.   else
  94.     configSave("colorTB","black")
  95.     configSave("colorTT","white")
  96.     configSave("colorMB","white")
  97.     configSave("colorST","blue")
  98.     configSave("colorBE","gray")
  99.     configSave("colorBF","lime")
  100.     configSave("colorBT","cyan")
  101.     configSave("colorPos","green")
  102.     configSave("colorNeg","red")
  103.   end
  104.   setup("Would you like to enable Redstone Output?","redstone",1," [y/n]")
  105.   if config("redstone") == "y" then
  106.     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")
  107.     setupSub("What side of the computer should the output be on?","side",1," right,left,front,back,top,bottom")
  108.     if config("bundled") == "1" then
  109.       setupSub("What color cable should the output be on?","colorPR",1," Case Sensitive")
  110.     else configSave("colorPR","0")
  111.     end
  112.   else
  113.     configSave("bundled","0")
  114.     configSave("side","0")
  115.     configSave("colorPR","0")
  116.   end
  117.   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")
  118.   setup("How many RF storage do you have?","storage", 1, "How much rf does your storage have?")
  119.   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")
  120.  
  121.   intro()  
  122.   print("Auto Restart in 3 seconds!") sleep(1)
  123.   print("Auto Restart in 2 seconds!") sleep(1)
  124.   print("Auto Restart in 1 seconds!") sleep(1)
  125.   print("Restarting...")
  126.  
  127.   startup = fs.open("startup","w")
  128.   startup.write('shell.run("program.lua")')
  129.   startup.close()
  130.  
  131.   os.reboot()
Add Comment
Please, Sign In to add comment