Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Coded by HPWebcamAble
- This program installs my Redstone Engine program and all of its components
- After you have run this once, you shouldn't need this again (if its successful)
- ]]
- 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
- if not term.isColor() then
- print("This program is designed for advanced computers only")
- return
- elseif not http then
- print("The Http api isn't enabled. Its required to download things from pastebin.")
- print("It can be enabled in the Computer Craft Config file.")
- return
- end
- print("The following files will be deleted if they exist:")
- print("Directory: RED")
- print("Program: RE")
- print(" ")
- print("Make sure existing programs don't have these names.")
- print("Press 'Tab' to cancel or 'Enter' to continue")
- local continue = false
- while true do
- event,key = os.pullEvent("key")
- if key == keys.enter then
- continue = true
- break
- elseif key == keys.tab then
- term.setTextColor(colors.red)
- print("Canceled")
- break
- end
- end
- if not continue then return end
- if fs.exists("RED") then
- shell.run("delete RED")
- end
- if fs.exists("RE") then
- shell.run("delete RE")
- end
- local problem = false
- shell.run("mkdir RED")
- shell.run("mkdir /RED/configs")
- if not get("t8qyvmSH","RE") then
- print("Could not download 'RE' shortcut program")
- problem = true
- else
- print("Downloaded 'RE' shortcut program")
- end
- if not get("uTJEepZQ","/RED/ConfigEditor") then
- print("Could not download 'ConfigEditor' program")
- problem = true
- else
- print("Downloaded 'ConfigEditor' program")
- end
- if not get("PT5jLy4i","/RED/RE") then
- print("Could not download 'RE' program")
- problem = true
- else
- print("Downloaded 'RE' program")
- end
- if problem then
- term.setTextColor(colors.red)
- print("Something when wrong. Program was not installed")
- else
- term.setTextColor(colors.lime)
- print("Program installed! Type 'RE' to run")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement