MoJoCreatior

Power Monitor Setup V:13

Feb 11th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.41 KB | None | 0 0
  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:13"
  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")
  16.     print(" ")
  17.   end
  18.  
  19.   function setup(question,file,binary,subText)
  20.     term.setBackgroundColour(colors.white)
  21.     term.clear()
  22.     intro()
  23.     term.setTextColour(colors.gray)
  24.     print(question)
  25.     if binary == 1 then
  26.       term.setTextColour(colors.lightGray)
  27.       print(subText)
  28.     end
  29.     term.setTextColour(colors.cyan)
  30.     fs.delete("config/"..file)
  31.     cfg = fs.open("config/"..file,"w")
  32.     answer = io.read()
  33.     cfg.write(answer)
  34.     cfg.close()
  35.   end
  36.  
  37.   function update()
  38.     fs.delete("program")
  39.     shell.run("pastebin get gX4D4aUY program")
  40.     fs.delete("startup")
  41.     boot = 'shell.run("program")'
  42.     startup = fs.open("startup","w")
  43.     startup.write(boot)
  44.     startup.close()
  45.   end
  46.  
  47.  
  48. --Setup
  49.   intro()
  50.   print(program.." Configuration and Installation Walkthrough")
  51.   term.setTextColour(colors.red)
  52.   print("Please Label this computer to prevent data loss.")
  53.   sleep(2)
  54.   setup("What do you want the Title to be?","title",1,"Titles will appear off screen if made too long")
  55.   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")
  56.   setup("Would you like Dynamic Text Scaling to be turned on?","dynamic",1,"[y/n]\n  Makes monitors update as you build them.\n  restart computer to update Text scaling.")
  57.   if not fs.exists("program") then update() else
  58.    setup("Do you want to Update?","update",1," [y/n]")
  59.   end
  60.   if answer == "y" then update() end
  61.  
  62.   intro()  
  63.   print("Auto Restart in 3 seconds!") sleep(1)
  64.   print("Auto Restart in 2 seconds!") sleep(1)
  65.   print("Auto Restart in 1 seconds!") sleep(1)
  66.   print("Restarting...")
  67.   os.reboot()
Add Comment
Please, Sign In to add comment