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 2.0' and all necesary components
- ]]
- --Functions--
- function clear() shell.run("clear") end
- function tc(...) term.setTextColor(...) end
- function get(sCode,sFile) --This function is a modified portion of the Pastebin program
- local sPath = shell.resolve( sFile )
- if fs.exists( sPath ) then
- return false
- end
- local response = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode( sCode ))
- if response then
- local sResponse = response.readAll()
- response.close()
- local file = fs.open( sPath, "w" )
- file.write( sResponse )
- file.close()
- return true
- else
- return false
- end
- end
- --Program--
- if not http then
- tc(colors.red)
- 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 2.0")
- tc(colors.white)
- print(" is ready to be installed")
- tc(colors.blue)
- print("Press any key...")
- os.pullEvent()
- os.pullEvent() --Captures both key and char events
- --Start the install
- 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...")
- pRename = "ARC"
- repeat
- pRename = pRename.."~"
- until not fs.exists(pRename)
- tc(colors.white)
- print("Renamed ARC to "..pRename)
- end
- end
- tc(colors.white)
- fs.makeDir("ARC")
- print("Successfully added directroy 'ARC'")
- --Download Advanced Redstone Control from pastebin
- print("Downloading program 'Advanced Redstone Control' (ARC)...")
- if get("7Y5sdrR4","ARC/ARC") then
- print("Success")
- else
- tc(colors.red)
- print("Could not download. Is pastebin working?")
- return
- end
- --Make Shortcut for Advanced Redstone Control
- print("Creating shortcut...")
- if fs.exists("rc") then
- tc(colors.orange)
- print("Program (or directory) 'rc' already exists. Renaming...")
- pRename = "rc"
- repeat
- pRename = pRename.."~"
- until not fs.exists(pRename)
- tc(colors.white)
- print("Renamed ARC to "..pRename)
- end
- f = fs.open("rc","w")
- f.write([[shell.run("/ARC/ARC")]])
- f.close()
- print("Shortcut created")
- tc(colors.lime)
- print("Advanced Redstone Control 2.0 installed!")
- tc(colors.blue)
- print("Type 'rc' to run it, then follow the instruction to create the buttons")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement