Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------PASTEBINs--------------------------
- installer = "fWnhLdRx"
- reactor_control_server_pastebin = "v1p9TQaV"
- reactor_control_client_pastebin = "wCYyVaPf"
- ---------------------------------------------
- term.clear()
- -------------------FORMATTING-------------------------------
- function draw_text_term(x, y, text, text_color, bg_color)
- term.setTextColor(text_color)
- term.setBackgroundColor(bg_color)
- term.setCursorPos(x,y)
- write(text)
- end
- function draw_line_term(x, y, length, color)
- term.setBackgroundColor(color)
- term.setCursorPos(x,y)
- term.write(string.rep(" ", length))
- end
- function progress_bar_term(x, y, length, minVal, maxVal, bar_color, bg_color)
- draw_line_term(x, y, length, bg_color) --backgoround bar
- local barSize = math.floor((minVal/maxVal) * length)
- draw_line_term(x, y, barSize, bar_color) --progress so far
- end
- function menu_bars()
- draw_line_term(1, 1, 55, colors.blue)
- draw_text_term(10, 1, "BigReactors Wireless Control Installer", colors.white, colors.blue)
- draw_line_term(1, 19, 55, colors.blue)
- draw_text_term(10, 19, "by Johannes aka JO__2001__BO", colors.white, colors.blue)
- end
- --------------------------------------------------------------
- function install(pastebin)
- term.clear()
- menu_bars()
- draw_text_term(1, 3, "Installing...", colors.yellow, colors.black)
- term.setCursorPos(1,5)
- term.setTextColor(colors.white)
- sleep(0.5)
- -----------------Install control program---------------
- shell.run("pastebin get "..pastebin.." startup")
- sleep(0.5)
- ------------------Install startup script-------------
- if fs.exists("startup") then
- draw_text_term(1, 11, "Success!", colors.lime, colors.black)
- draw_text_term(1, 12, "Press Enter to reboot...", colors.gray, colors.black)
- wait = read()
- shell.run("reboot")
- else
- draw_text_term(1, 11, "Error installing file.", colors.red, colors.black)
- sleep(0.1)
- draw_text_term(1, 14, "Press Enter to continue...", colors.gray, colors.black)
- wait = read()
- start()
- end
- end
- function selectProgram()
- term.clear()
- menu_bars()
- draw_text_term(1, 4, "What would you like to install or update?", colors.yellow, colors.black)
- draw_text_term(3, 6, "1 - Reactor Control Client", colors.white, colors.black)
- draw_text_term(3, 7, "2 - Reactor Control Server", colors.white, colors.black)
- draw_text_term(1, 9, "Enter 1 or 2:", colors.yellow, colors.black)
- term.setCursorPos(1,10)
- term.setTextColor(colors.white)
- input = read()
- if input == "1" then
- install(reactor_control_client_pastebin)
- else if input == "2" then
- install(reactor_control_server_pastebin)
- else
- draw_text_term(1, 12, "please enter a '1' or '2'.", colors.red, colors.black)
- sleep(1)
- start()
- end
- end
- end
- function start()
- term.clear()
- menu_bars()
- selectProgram()
- end
- start()
Add Comment
Please, Sign In to add comment