Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local initScriptID = "Bp4bQJb7"
- local scripts = {}
- scripts["iPW77diY"] = "miner"
- local args = {...}
- function loadScript(code, name)
- if fs.exists(name) == true then
- shell.run("rm", name)
- end
- shell.run("pastebin","get",code,name)
- end
- if args[1] == "get" then
- if args[2] ~= nil then
- found = false
- for code, name in pairs(scripts) do
- if name == args[2] then
- found = true
- term.clear()
- term.setCursorPos(0,0)
- print("\nLoading Script ["..name.."]")
- pcall(loadScript, code, name)
- break
- end
- end
- if not found then
- print("\nFailed to load script ["..name.."]")
- return
- end
- else
- local progress = 0
- local qty = table.getn(scripts)
- for code, name in pairs(scripts) do
- term.clear()
- term.setCursorPos(0,0)
- print("\nLoading Scripts: [ "..progress.." of "..qty.." ]")
- pcall(loadScript, code, name)
- progress = progress + 1
- end
- end
- os.reboot()
- else
- term.clear()
- term.setCursorPos(0,0)
- print("\nUpdating Self ...")
- pcall(loadScript, initScriptID, "init")
- shell.run("init", "get")
- end
Add Comment
Please, Sign In to add comment