Advertisement
HaZePug

AdvancedBoot

Feb 19th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. -- Functions
  2. function s(...) return sleep(...) end
  3. function w(...) return write(...) end
  4. function p(...) return print(...) end
  5. function tw(...) return term.write(...) end
  6. function scp(...) return term.setCursorPos(...) end
  7. function sbc(...) return term.setBackgroundColor(...) end
  8. function stc(...) return term.setTextColor(...) end
  9. function tc(...) return term.clear(...) end
  10. function tcl(...) return term.clearLine() end
  11. function scb(...) return term.setCursorBlink(...) end
  12. function ts(...) return term.scroll(...) end
  13. function r(...) return shell.run(...) end
  14. function para(...) return parallel.waitForAny(...) end
  15. function sw(...) return textutils.slowWrite(...) end
  16. function sp(...) return textutils.slowPrint(...) end
  17.  
  18. local function options()
  19. while true do
  20. local event, key = os.pullEvent("key")
  21. if key == keys.left then
  22. option = "1"
  23. sbc( colors.green )
  24. scp(17,12)
  25. term.write("[Yes]")
  26. scp(36,12)
  27. sbc( colors.red )
  28. w([[ No ]])
  29.  
  30.  
  31. elseif key == keys.right then
  32. option = "2"
  33. scp(36,12)
  34. sbc( colors.red )
  35. term.write("[No]")
  36. sbc( colors.green )
  37. scp(17,12)
  38. w([[ Yes ]])
  39.  
  40. elseif key == keys.enter and option == "2" then
  41. shell.run('Services/AdvancedBoot')
  42. elseif key == keys.enter and option == "1" then
  43. sleep(1)
  44. sbc(1)
  45. term.clear()
  46. os.reboot()
  47. end
  48. end
  49.  
  50. end
  51.  
  52. local function update()
  53. while true do
  54. local event, key = os.pullEvent("key")
  55. if key == keys.left then
  56. option = "1"
  57. sbc( colors.green )
  58. scp(17,12)
  59. term.write("[Yes]")
  60. scp(36,12)
  61. sbc( colors.red )
  62. w([[ No ]])
  63.  
  64.  
  65. elseif key == keys.right then
  66. option = "2"
  67. scp(36,12)
  68. sbc( colors.red )
  69. term.write("[No]")
  70. sbc( colors.green )
  71. scp(17,12)
  72. w([[ Yes ]])
  73.  
  74. elseif key == keys.enter and option == "2" then
  75. shell.run('Services/AdvancedBoot')
  76. elseif key == keys.enter and option == "1" then
  77. shell.run('disk/Updates/UpdaterProgram')
  78.  
  79. sleep(10)
  80. os.reboot()
  81. end
  82. end
  83.  
  84. end
  85.  
  86.  
  87. local function reboot()
  88. while true do
  89.  
  90. local event, button, X, Y = os.pullEvent("mouse_click")
  91.  
  92. if X >= 20 and X <= 28 and Y == 8 then
  93. sbc(1)
  94. term.clear()
  95. scp(15,8)
  96. sbc( colors.blue )
  97. w([[ ]])
  98. sbc( colors.lightGray )
  99. scp(15,9)
  100. w([[ Are You Sure You Want ]])
  101. scp(15,10)
  102. w([[ To Reboot? ]])
  103. scp(15,11)
  104. w([[ ]])
  105. scp(15,12)
  106. w([[ ]])
  107. sbc( colors.green )
  108. scp(17,12)
  109. w([[ Yes ]])
  110. scp(36,12)
  111. sbc( colors.red )
  112. w([[ No ]])
  113. options()
  114. elseif X >= 20 and X <= 29 and Y == 10 then
  115. sbc(1)
  116. term.clear()
  117. scp(15,8)
  118. sbc( colors.blue )
  119. w([[ ]])
  120. sbc( colors.lightGray )
  121. scp(15,9)
  122. w([[ Please Login As A ]])
  123. scp(15,10)
  124. w([[ Administrator ]])
  125. scp(15,11)
  126. w([[ ]])
  127. scp(15,12)
  128. w([[ ]])
  129. scp(15,13)
  130. w([[ ]])
  131. scp(17,11)
  132. sbc( colors.white )
  133. w([[ ]])
  134. scp(17,12)
  135. w([[ ]])
  136. scp(17,11)
  137. stc( colors.black )
  138. username = read()
  139. scp(17,12)
  140. password = read("*")
  141.  
  142. if username == username1 and password == userpass1 then
  143. shell.run('Programs/AdvancedConsole')
  144. else
  145. shell.run('Services/AdvancedBoot')
  146. end
  147.  
  148.  
  149. elseif X >= 20 and X <= 34 and Y == 12 then
  150. sbc(1)
  151. term.clear()
  152. scp(15,8)
  153. sbc( colors.blue )
  154. w([[ ]])
  155. sbc( colors.lightGray )
  156. scp(15,9)
  157. w([[ Are You Sure You Want ]])
  158. scp(15,10)
  159. w([[ Force Update? ]])
  160. scp(15,11)
  161. w([[ ]])
  162. scp(15,12)
  163. w([[ ]])
  164. sbc( colors.green )
  165. scp(17,12)
  166. w([[ Yes ]])
  167. scp(36,12)
  168. sbc( colors.red )
  169. w([[ No ]])
  170. update()
  171. end
  172. end
  173. end
  174.  
  175.  
  176.  
  177.  
  178. sbc(1)
  179. stc( colors.blue )
  180. term.clear()
  181. scp(15,1)
  182. print("Advanced Boot Options")
  183. scp(20,8)
  184. sbc( colors.blue )
  185. stc( colors.white )
  186. print(" Reboot ")
  187. scp(20,10)
  188. print(" Console ")
  189. scp(20,12)
  190. print(" Force Update ")
  191. reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement