Advertisement
Guest User

FTL save backer upper

a guest
Dec 9th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ::hey, stop bullying my source code and just use this boi
  2. ::made by Paradigm#0001
  3. @echo off
  4. SETLOCAL EnableDelayedExpansion
  5. title FTL save backer upper
  6. set confignotexist=0
  7. if not exist "%cd%\config.ini" (
  8.     set confignotexist=1 & goto introskip
  9. )
  10. set /p config1=<"%cd%\config.ini"
  11. (   for /L %%A in (1,1,1) do (
  12.         set /p =
  13.     )
  14.     set /p config2=
  15. ) <"%cd%\config.ini"
  16. set !config1!
  17. set !config2!
  18. if exist !SAVDUMPDIR! (
  19.     goto skip1
  20. )
  21. :introskip
  22. if not exist "%SystemDrive%\Users\%USERNAME%\Documents\My Games\FasterThanLight" (
  23.     MSG %USERNAME% The current FTL save directory could not be found
  24.     goto invalidFTLDIR
  25. )
  26. set "FTLSAVDIR=%SystemDrive%\Users\%USERNAME%\Documents\My Games\FasterThanLight"
  27. goto skip1
  28. :invalidFTLDIR
  29. set /p FTLSAVDIR="Please enter the current FTL save directory:"
  30. if not exist "!FTLSAVDIR!" (
  31.     cls & choice /m "The current directory you entered does not exist, Would you like to try again?"
  32.     if !ERRORLEVEL!==1 (
  33.         cls & goto invalidFTLDIR
  34.     )
  35. )
  36. :skip1
  37. if %confignotexist%==1 (
  38.     goto pollingratechoice
  39. )
  40. choice /m "Would you like to change the polling rate?"
  41. if !ERRORLEVEL!==2 (
  42.     cls & goto savdirerror
  43. )
  44. :pollingratechoice
  45. cls
  46. echo 1. 1000ms
  47. echo 2. 500ms
  48. echo 3. 250ms
  49. echo 4. 100ms
  50. echo 5. Custom
  51. choice /c 12345 /n /m "Please select the update rate at which your save will checked for changes and backed up:"
  52. if %ERRORLEVEL%==1 (
  53.     set RATE=1000
  54. ) else if %ERRORLEVEL%==2 (
  55.     set RATE=500
  56. ) else if %ERRORLEVEL%==3 (
  57.     set RATE=250
  58. ) else if %ERRORLEVEL%==4 (
  59.     set RATE=100
  60. ) else if %ERRORLEVEL%==5 (
  61.     :RATEerror
  62.     cls
  63.     set /p RATE="Please enter [in milliseconds] the update rate: "
  64.     set /a RATE+=0
  65.     if !RATE! LEQ 75 (
  66.     echo:
  67.     echo The value entered cannot be a string[text] or below 75ms
  68.     pause
  69.     cls
  70.     goto RATEerror
  71.     )
  72. )
  73. set "config1=POLLINGRATE=!RATE!"
  74. set RETURN=Pollingratereturn
  75. goto configsave
  76. :Pollingratereturn
  77. set !config1!
  78. set RETURN=savdirerror
  79. goto configsave
  80. :savdirerror
  81. cls
  82. if %confignotexist%==1 (
  83.     goto SAVDUMPDIRchoice
  84. )
  85. choice /m "Would you like to change the save location?"
  86. iz`f !ERRORLEVEL!==2 (
  87.     goto skip2
  88. )
  89. :SAVDUMPDIRchoice
  90. cls
  91. set /p SAVDUMPDIR="Please enter a directory to save updated .sav files to: "
  92. if not exist "!SAVDUMPDIR!" (
  93.     cls & echo !SAVDUMPDIR! does not exist, Please enter another directory. & pause & goto SAVDUMPDIRchoice
  94. )
  95. set config2=SAVDUMPDIR=!SAVDUMPDIR!
  96. set RETURN=skip2
  97. goto configsave
  98. :skip2
  99. cls
  100. chdir /D !FTLSAVDIR!
  101. :update1
  102. for %%a in (continue.sav) do set continueChange=%%~tza
  103. :update2
  104.     ping -n 2 -w !POLLINGRATE! localhost >nul
  105.     for %%a in (continue.sav) do if "!continueChange!"=="%%~tza" (
  106. goto update2
  107. )
  108. for %%a in (continue.sav) do set continueChange=%%~tza
  109. copy /y "continue.sav" "!SAVDUMPDIR!"
  110. goto update1
  111. :configsave
  112. del "%CD%\config.ini" >nul 2>&1
  113. (for %%A in (
  114.     "!config1!"
  115.     "!config2!"
  116. ) do echo.%%~A)> "%CD%\config.ini"
  117. goto !RETURN!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement