Advertisement
Guest User

FTL save backer upper

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