Advertisement
Guest User

FTL Batch

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