LezChap

Install slateControl

Jun 1st, 2015
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. fileNames = { "slateControl", "gui", "blank", "reinforced", "imbued", "demonic", "ethereal", "startup2" }
  2. pastebins = { "VNipiBCm", "e5BTwCf7", "VeUdQcV5", "Bd3k4MET", "xV12cWrp", "XwhmXPwN", "JxS4jjGW", "JxS4jjGW" }
  3. goAhead = {}
  4. term.clear()
  5. term.setCursorPos(1,1)
  6.  
  7. print("You are attempting to install LezChap's Slate Crafting Terminal. Please wait while we check your system's available memory...")
  8. print(" ")
  9.  
  10. function checkFile(name)
  11. if fs.exists(name) then
  12. sleep(.5)
  13. print("File '"..name.."' already exists. It must be removed to continue the install, do you wish to delete the original file? (Y or N)")
  14. local waiting = true
  15. os.startTimer(1)
  16. while waiting do
  17. event, param1, param2 = os.pullEvent()
  18. if event == "timer" then
  19. os.startTimer(1)
  20. end
  21. if event == "char" then
  22. if param1 == "y" or param1 == "Y" then
  23. print(param1)
  24. fs.delete(name)
  25. waiting = false
  26. return true
  27. end
  28. if param1 == "n" or param1 == "N" then
  29. print(param1)
  30. print("Installation cannot continue...you selected No.")
  31. os.queueEvent("terminate")
  32. sleep(1)
  33. waiting = false
  34. return false
  35. end
  36. end
  37. end
  38. else
  39. return true
  40. end
  41. end
  42.  
  43. for k,v in ipairs(fileNames) do
  44. if checkFile(v) then
  45. goAhead[k] = true
  46. end
  47. end
  48.  
  49. fail = false
  50.  
  51. for k, v in pairs(goAhead) do
  52. if not v then
  53. fail = true
  54. break
  55. end
  56. end
  57.  
  58. if fail then
  59. print("Cannot install the Slate Crafting Terminal, you must have selected to not delete a file.")
  60. print("Please fix the problem and try again.")
  61. else
  62. print("Downloading Programs:")
  63. for k,v in ipairs(fileNames) do
  64. print(v..":")
  65. shell.run("pastebin get "..pastebins[k].." "..v)
  66. end
  67. print("Installation complete. Please rename 'startup2' to 'startup' to run automatically on boot.")
  68. print("Make sure to edit the Redstone input/output directions in the variables at the top of 'slateControl' or the program won't function properly.")
  69. print("Requires a properly configured SFM setup. Please see the following album for an idea on how to accomplish this: http://imgur.com/a/es2gi")
  70. end
Advertisement
Add Comment
Please, Sign In to add comment