Savage_Me55iah

AutocraftInstaller

Jul 19th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 KB | None | 0 0
  1. --Script by Savage_Me55iah of CraftAU.com.au--
  2.  
  3. --Other Savage_Me55iah scripts @ http://pastebin.com/u/Savage_Me55iah
  4.  
  5. --INSTRUCTIONS ON USE--
  6. --Instruction video on http://youtube.com/savagemessiah5
  7.  
  8. --Contact Savage_Me55iah @ CraftAU.com.au or Nuqube.co or http://www.computercraft.info/forums2/ with suggestions/fixes/bugs
  9.  
  10. local scriptName = "Installer_Autocrafter"
  11. fileDetail = fileDetail or {}
  12. fileDetail[scriptName] = {["version"] = 0.1, ["pastebin"] = "5fvYzdDQ"}
  13.  
  14.  
  15. function runPastebin(param_filename, param_pastebinCode) shell.run("pastebin get "..param_pastebinCode.." "..param_filename) end
  16.  
  17. local tArgs = {...}
  18. if tostring(tArgs[1]) == "update" then runPastebin("installer", fileDetail["Installer_Autocrafter"]["pastebin"]) end
  19.  
  20. local files = {
  21.     ["DataStore"] = {
  22.         ["currentLog"] = {},
  23.         ["previousLog"] = {},
  24.         ["Errors"] = {}
  25.     },
  26.     ["Program"] = {
  27.         ["CC_AutoCrafter"] = "gECkmMyg"
  28.     },
  29.     ["Run"] = "ZtUrtP3p",
  30.     ["sm_API"] = {
  31.         ["loadAPIs"] = "0FMzFMsP",
  32.         ["logger"] = "9zBzHK0N",
  33.         ["generalinfo"] = "4a8jhYMe",
  34.         ["booleanmanip"] = "irkktmgP",
  35.         ["tablemanip"] = "1FxrRa1w",
  36.         ["eventmanip"] = "AijGThy5",
  37.         ["coroutinemanip"] = "MrMAuAkc",
  38.         ["buttonmanip"] = "qtD3jeMK"
  39.     }
  40. }
  41.  
  42. -- BACKSLASH WAS MESSING WITH MY SCRIPT EDITOR
  43. function insertBS()
  44.     local result = "\\"
  45.     return result
  46. end
  47.  
  48. createFileStructure = nil
  49.  
  50. function createFileStructureF(...) local result = nil if tostring(createFileStructure) ~= "nil" then result = createFileStructure(...) end return result end
  51.  
  52. function createFileStructure(param_directory, param_next)
  53.     for a,b in pairs(param_next) do
  54.         if type(b) == "table" then
  55.             local directory = nil
  56.             if tostring(param_directory) ~= "nil" then
  57.                 directory = param_directory..insertBS()..a
  58.             else
  59.                 directory = a
  60.             end
  61.             if not fs.exists(directory) then
  62.                 fs.makeDir(directory)
  63.             end
  64.             createFileStructureF(directory, b)
  65.         elseif type(b) == "string" then
  66.             if tostring(param_directory) ~= "nil" then
  67.                 directory = param_directory..insertBS()..a
  68.             else
  69.                 directory = a
  70.             end
  71.             if fs.exists(directory) then
  72.                 fs.delete(directory)
  73.                 print("replacing: "..directory)
  74.             end
  75.             runPastebin(directory, b)
  76.         end
  77.     end
  78. end
  79.  
  80. createFileStructureF(nil, files)
  81.  
  82. print("Installation completed")
  83. print("run script >run< to start")
Advertisement
Add Comment
Please, Sign In to add comment