Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --2.5 by JDowe Feb-18-2025
- --based on the computercraft pastebin script.
- local code = {"9SkTv988", "GL8gn3ZS", "0b0zL6cx"}
- local file = {"QuarryRepeater", "QuarryReceiver", "turtleQuarry"}
- function getSettings(file)
- local curSettings = file
- for i = 1, #curSettings do
- textutils.pagedPrint( tonumber( i ) .. " : " .. curSettings[i] )
- end
- end
- local input = nil
- local start = 0
- local stop = 0
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- if not http then
- print( "Pastebin requires http API" )
- print( "Set enableAPI_http to 1 in mod_ComputerCraft.cfg" )
- return
- end
- clear()
- print("Enter the corresponding number from the list or enter 0 to get all\n")
- while input == nil do
- for i=1, #file do
- write(i..":"..file[i].." ")
- end
- -- for i = 1, #file do
- -- textutils.pagedPrint( tonumber( i ) .. " : " .. file[i] )
- --end
- print("")
- input = tonumber(read())
- if input == 0 then
- start = 1
- stop = #code
- else
- start = input
- stop = input
- end
- if input == nil then
- clear()
- print("Try again, but this time enter the NUMBER, or enter 0 for all, or hold ctrl+t to exit.\n")
- end
- end
- for i=start, stop do
- -- Download a file from pastebin.com
- -- Determine file to download
- local sCode = code[i]
- local sFile = file[i]
- local sPath = shell.resolve( sFile )
- if fs.exists( sPath ) then
- --this will delete a script of the same name you are downloading to make room.
- --Good for updating scripts you have edited on pastebin.
- fs.delete( sPath )
- end
- -- GET the contents from pastebin
- write( "Connecting to pastebin.com... " )
- local response = http.get(
- "http://pastebin.com/raw.php?i="..textutils.urlEncode( sCode )
- )
- if response then
- print( "Success." )
- local sResponse = response.readAll()
- response.close()
- local file = fs.open( sPath, "w" )
- file.write( sResponse )
- file.close()
- term.clear()
- term.setCursorPos(1,1)
- print( "Downloaded as "..sFile )
- sleep(1)
- else
- print( "Failed." )
- end
- print( "Thank you for using Mr John Dowe's programs, have fun!" )
- sleep(1)
- --shell.switchTab( shell.openTab(sFile) )
- shell.run( sFile )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement