Advertisement
dadragon84

Severino Self Installer

Apr 30th, 2023
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --2.0 by Severino Aug-11-2015
  2. --based on the computercraft pastebin script.
  3.  
  4. local code = {"WK68jh5d", "rJLuHR0g", "uzK5V1Kv", "YcDngWFp", "AE71CRnY", "BK6MCrZp", "tPKK0Vs3", "uwSCGam1", "bbz6S5Kw", "w4AGQE05", "h5n2gz7G", "ynVAgpaF", "d0hdE723", "f4rSnip8", "G6awvV8s", "FitDngkH", "meRmax76", "0JfKCUr1", "nna2VsZG", "uUPWBgPF", "EZqd0er1", "9GrQ8CT8","ZgGfdQkn","ZUiiQZHz","k2RpDss9","JxkPZ0FJ","ZLYJ9R4c","wC94sWss"}
  5. local file = {"TreeCutter", "TurtleFarm", "Marquee1", "Marquee2", "BigTreeFarm", "MinerInstall", "TreeFarm", "Monitor", "todolist", "WheatFarm", "Duties", "stairs", "TreeLogger", "RoomClear", "RoomMaker", "Quarry", "HouseBuilder", "TimberHouse", "TownHouse", "TouchScreen", "TreeFarmNoFuel", "inventorycontrol", "Server_Rules","Keycard","Schematica","Security_Code_Lock","File_Deleter","Bank_Installer"}
  6.  
  7. function getSettings(file)
  8.    local curSettings = file
  9.  
  10.     for i = 1, #curSettings do
  11.       textutils.pagedPrint( tonumber( i ) .. " : " .. curSettings[i] )
  12.     end
  13. end
  14.  
  15.  
  16. local input = nil
  17. local start = 0
  18. local stop = 0
  19.  
  20. function clear()
  21.   term.clear()
  22.   term.setCursorPos(1,1)
  23. end
  24.  
  25. if not http then
  26.     print( "Pastebin requires http API" )
  27.     print( "Set enableAPI_http to 1 in mod_ComputerCraft.cfg" )
  28.     return
  29. end
  30.  
  31. clear()
  32. print("Enter the corresponding number from the list or enter 0 to get all\n")
  33.  
  34. while input == nil do
  35.    for i=1, #file do
  36.     write(i..":"..file[i].."   ")
  37.   end
  38.    -- for i = 1, #file do
  39.     --  textutils.pagedPrint( tonumber( i ) .. " : " .. file[i] )
  40.     --end
  41.    print("")
  42.    input = tonumber(read())
  43.    if input == 0 then
  44.       start = 1
  45.       stop = #code
  46.    else
  47.       start = input
  48.       stop = input
  49.    end
  50.    if input == nil then
  51.       clear()
  52.       print("Try again, but this time enter the NUMBER, or enter 0 for all, or hold ctrl+t to exit.\n")  
  53.    end
  54. end
  55.  
  56. for i=start, stop do
  57.     -- Download a file from pastebin.com
  58.     -- Determine file to download
  59.     local sCode = code[i]
  60.     local sFile = file[i]
  61.     local sPath = shell.resolve( sFile )
  62.     if fs.exists( sPath ) then
  63.                 --this will delete a script of the same name you are downloading to make room.
  64.                 --Good for updating scripts you have edited on pastebin.
  65.         fs.delete( sPath )
  66.     end
  67.    
  68.     -- GET the contents from pastebin
  69.     write( "Connecting to pastebin.com... " )
  70.     local response = http.get(
  71.         "http://pastebin.com/raw.php?i="..textutils.urlEncode( sCode )
  72.         )
  73.        
  74.     if response then
  75.         print( "Success." )
  76.        
  77.         local sResponse = response.readAll()
  78.         response.close()
  79.        
  80.         local file = fs.open( sPath, "w" )
  81.         file.write( sResponse )
  82.         file.close()
  83.        
  84.         term.clear()
  85.         term.setCursorPos(1,1)
  86.         print( "Downloaded as "..sFile )
  87.         sleep(1)
  88.        
  89.        
  90.     else
  91.         print( "Failed." )
  92.     end
  93.  
  94. print( "Thank you for using Mr John Dowe's programs, have fun!" )
  95. sleep(1)
  96. shell.switchTab( shell.openTab(sFile) )    
  97. --shell.run( sFile )
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement