emil_sawicki

Workers & Resources: Soviet Republic - easier building of vanilla buildings

Jan 12th, 2021 (edited)
2,429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.01 KB | None | 0 0
  1. :: put this script in "..\steamapps\common\SovietRepublic\media_soviet\buildings_types\buildings_types.bat"
  2. :: run it once before launching the game if new buildings added and wait until end
  3. CLS
  4. @ECHO OFF
  5. SETLOCAL EnableDelayedExpansion
  6. SET /A count=0
  7. SET "$New_line=$HARBOR_EXTEND_AREA_WHEN_BULDING -500"
  8. :: list files to be changed
  9. ECHO Preparing list of files...
  10. DIR /B /S *.ini >> list.txt
  11. :: count lines in list.txt to variable "lines"
  12. SET _File=list.txt
  13. SET /a lines=0
  14. FOR /f %%H in ('FIND "" /V /C ^< %_File%') DO SET /a lines=%%H
  15. :: main task - edit files
  16. FOR /F "tokens=*" %%G IN (list.txt) DO (
  17.  SET /A "count=!count!+1"
  18. :: search for line
  19.  FIND "$HARBOR_EXTEND_AREA_WHEN_BULDING" %%~nG.ini >NUL
  20. :: line not found so edit file
  21.   IF ERRORLEVEL 1 (
  22.    ECHO %$New_line% > "New_%%~nG.ini"
  23.    TYPE "%%G" >> "New_%%~nG.ini"
  24.    DEL "%%~nG.ini" >NUL
  25.    REN "New_%%~nG.ini" "%%~nG.ini"
  26.   )
  27.  CLS
  28.  ECHO Total !count! of !lines! files ready.
  29.  ECHO made in 2021 by Emil Sawicki
  30. )
  31. DEL list.txt >NUL
  32. PAUSE
Add Comment
Please, Sign In to add comment