Advertisement
blaale

CC init

Jun 19th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1. local initScriptID = "RLq0E2TP"
  2. local scripts = {}
  3.  
  4. --[[
  5.     Register scripts as scripts[<pastebin_code>]="<name>"
  6.     Run:
  7.         pastebin get RLq0E2TP init
  8. ]]
  9.  
  10. scripts["hwZXFWRE"] = "t"
  11. scripts["V46V5dSW"] = "json"
  12. scripts["GnFzX6HF"] = "area"
  13. scripts["0hejcfq6"] = "room"
  14. scripts["w2fFVnAi"] = "platform"
  15. scripts["gkz5sgZ8"] = "OCM"
  16. scripts["ctDZxPUy"] = "go"
  17. scripts["2nVVg7Ak"] = "treefarm"
  18. scripts["j8cdrVFf"] = "quarry"
  19. scripts["VDEU15qB"] = "fly"
  20. scripts["S5gHj9vN"] = "oreHUD"
  21. scripts["HMfxKQT1"] = "quarry2"
  22. scripts["Fd3hEPbk"] = "autocraft"
  23. -- no touchey from here
  24.  
  25. local args = {...}
  26.  
  27. -- load function
  28. function loadScript(code, name)
  29.     if fs.exists(name) == true then
  30.         shell.run("rm", name)
  31.     end
  32.     shell.run("pastebin","get",code,name)
  33. end
  34.  
  35. -- get
  36. if args[1] == "get" then
  37.  
  38.     if args[2] ~= nil then
  39.         -- get single
  40.         found = false
  41.         for code, name in pairs(scripts) do
  42.             if name == args[2] then
  43.                 found = true
  44.                 term.clear()
  45.                 term.setCursorPos(0,0)
  46.                 print("\nLoading Script ["..name.."]")
  47.                 pcall(loadScript, code, name)
  48.                 break
  49.             end
  50.         end
  51.         if not found then
  52.             print("\nFailed to load script ["..name.."]")
  53.             return
  54.         end
  55.     else
  56.         -- load scripts
  57.         local progress = 0
  58.         local qty = 0
  59.         for k in pairs(scripts) do
  60.             qty = qty + 1      
  61.         end
  62.         for code, name in pairs(scripts) do
  63.             progress = progress + 1
  64.             term.clear()
  65.             term.setCursorPos(0,0)
  66.             print("\nLoading Scripts: [ "..progress.." of "..qty.." ]")
  67.             pcall(loadScript, code, name)
  68.         end
  69.     end
  70.  
  71.     -- end
  72.     print("\nCreeChyCode Intialised! :)")
  73. else
  74.     -- update self
  75.     term.clear()
  76.     term.setCursorPos(0,0)
  77.     print("\nUpdating Self ...")
  78.  
  79.     pcall(loadScript, initScriptID, "init")
  80.     shell.run("init", "get")
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement