Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --v2.4 by GraySloth 2013-Mar-05
- --here is a old video demonstration of my scripts, it is almost good. http://youtu.be/9vhl7dSENs8
- --based on the computercraft pastebin script.
- --you can use it for your scripts just replace the codes below and their corresponding names
- local code = {"WK68jh5d", "Hed6CHcw", "9TUMx5PF", "WZAL4m7k", "Wc0pe95Z", "yigYBdad", "UkzR2J5T", "RyCpNStV", "M1j5n7ZY", "uq08abej", "cDfcamyP", "VYbhTFqm"}
- local file = {"strip", "stairs", "shaft", "fuel", "fell", "monStartup", "clock", "feed", "fill", "thaum", "lamp", "xp"}
- 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
- 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()
- print( "Downloaded as "..sFile )
- else
- print( "Failed." )
- end
- end
- print( "Thank you for using GraySloth's programs, have fun!" )
Advertisement
Add Comment
Please, Sign In to add comment