QuickMuffin8782-Alt

Installer template

Oct 26th, 2020
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function autoShell(cmd)
  2. term.setTextColor(colors.yellow)
  3. write("> ")
  4. term.setTextColor(colors.white)
  5. textutils.slowWrite(cmd, 50)
  6. shell.run(cmd)
  7. end
  8.  
  9. function ask(msg)
  10. local x, y = term.getCursorPos()
  11. while true do
  12. term.setCursorPos(1, y)
  13. term.clearLine()
  14. write(msg .. " ")
  15. local out = read(nil)
  16. if out:len() == 1 then
  17. if out == "y" then
  18. return true
  19. elseif out == "n" then
  20. return false
  21. end
  22. end
  23. end
  24. end
  25.  
  26. if ask("Auto install <program name> to this computer?") then
  27. else
  28. printError("Canceled installation.")
  29. end
Add Comment
Please, Sign In to add comment