Advertisement
Guest User

FTL save backer upper

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