Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Coded by HPWebcamAble
- http://pastebin.com/u/HPWebcamAble
- This installs 'Advanced Redstone Control 3.x' and all necessary components
- **Multiplayer Note:** This script has been modified for multiplayer functionality.
- - Server-side script approach: Move download logic to server-side script.
- - Resource pack approach: Package files as a resource pack.
- ]]
- function clear() shell.run("clear") end
- function tc(...) term.setTextColor(...) end
- -- (Replace with server-side download logic or reference to resource pack location)
- function getProgram(programName, targetPath)
- -- Download or access program from server-side location or resource pack
- -- ... (implementation details based on chosen approach)
- -- Handle potential errors during download
- local response = http.get("http://pastebin.com/raw/" .. textutils.urlEncode(programName))
- if not response then
- print("Error downloading " .. programName .. ": HTTP request failed")
- return false
- end
- local content = response.readAll()
- response.close()
- if not content or content == "" then
- print("Error downloading " .. programName .. ": Empty response")
- return false
- end
- local file = fs.open(targetPath, "w")
- file.write(content)
- file.close()
- return true
- end
- --Program--
- if not http then
- print("HTTP api is disabled on this world/Server")
- return
- elseif not term.isColor() then
- tc(colors.red)
- print("This program requires an advanced computer")
- return
- end
- clear()
- tc(colors.yellow)
- term.write("Advanced Redstone Control 3.0")
- tc(colors.white)
- print(" is ready to be installed")
- tc(colors.blue)
- print("Press any key...")
- os.pullEvent("key")
- os.pullEvent("char")
- clear()
- tc(colors.white)
- print("Installing...")
- --Add ARC directory
- print("Adding directory 'ARC'...")
- if fs.exists("ARC") then
- if fs.isDir("ARC") then
- tc(colors.orange)
- print("Directory 'ARC' already exists on this computer")
- tc(colors.red)
- print("Install terminated. Remove or rename directory 'ARC'")
- return
- else
- tc(colors.orange)
- print("ARC exists as a program. Renaming...")
- local pRename = "ARC"
- repeat
- pRename = pRename .. "~"
- until not fs.exists(pRename)
- tc(colors.white)
- print("Renamed ARC to " .. pRename)
- shell.run("rename ARC " .. pRename)
- end
- end
- tc(colors.white)
- fs.makeDir("ARC")
- print("Successfully added directory 'ARC'")
- --Download Advanced Redstone Control (use getProgram function)
- print("Downloading program 'Advanced Redstone Control' (ARC)...")
- if getProgram("2ZPhx6ec", "ARC/ARC") then
- print("Success")
- else
- tc(colors.red)
- print("Could not download. Is the resource pack installed?") -- Adjust message based on approach
- return
- end
- --Download Config Editor (use getProgram function)
- print("Downloading program 'Config Editor' (configeditor)...")
- if getProgram("cKunvkD2", "ARC/configeditor") then
- print("Success")
- else
- tc(colors.red)
- print("Could not download. Is the resource pack installed?") -- Adjust message based on approach
- return
- end
- --Make Shortcut for Advanced Redstone Control
- print("Downloading shortcut (rc)...")
- if fs.exists("rc") then
- tc(colors.orange)
- print("rc program already exists. Renaming...")
- local pRename = "rc"
- repeat
- pRename = pRename .. "~"
- until not fs.exists(pRename)
- tc(colors.white)
- print("Renamed rc to " .. pRename)
- shell.run("rename rc " .. pRename)
- end
- if getProgram("y2pZUC3c", "rc") then
- print("Success")
- else
- tc(colors.red)
- print("Could not download. Is the resource pack installed?")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement