nd4spd

KFRandom.bat NEW

Oct 13th, 2025 (edited)
1,010
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.65 KB | Software | 0 0
  1. ::------------------------------------------------------------------------------
  2. :: Starts a Killing Floor server with a randomly-selected ROM file.
  3. ::------------------------------------------------------------------------------
  4. @echo off
  5. :: Ordinarily I'd enable delayed expansion to make things easier, but I don't
  6. :: know for certain that none of your ROM files contain an exclamation point,
  7. :: which would break things. We absolutely want setlocal here, though.
  8. setlocal disabledelayedexpansion
  9. set "verbose=false"
  10. if /I "%~1"=="-v" set "verbose=true"
  11.  
  12. set "workdir=D:\Apache24\htdocs"
  13. pushd "%workdir%"
  14. if "%verbose%"=="true" echo Current directory is: "%cd%"
  15.  
  16. set "counter=0"
  17. for /f "delims=" %%i in ('dir /b /a:-d kf-*.rom') do (
  18.     call set "rom_list[%%counter%%]=%%~i"
  19.     set /a counter+=1
  20.     if "%verbose%"=="true" call echo Rom file %%counter%% found: %%~i
  21. )
  22. set /a rnd_num=%RANDOM% %% %counter%
  23. call set "filename=%%rom_list[%rnd_num%]%%"
  24. if "%verbose%"=="true" (
  25.     set rom_list
  26.     set filename
  27. )
  28.  
  29. popd
  30. if "%verbose%"=="true" echo Current directory is: "%cd%"
  31.  
  32. call :start_kf_server
  33.  
  34. exit /b
  35.  
  36. ::------------------------------------------------------------------------------
  37. :: Start the Killing Floor server with the random map file
  38. ::
  39. :: Arguments: None
  40. :: Returns:   None
  41. ::------------------------------------------------------------------------------
  42. :start_kf_server
  43. echo Starting Killing Floor server with file "%filename%"
  44. pause
  45. >>KFRandom.txt echo "%filename%"
  46. ucc server %fileName%?Mutator=MML.ML04?game=KFmod.KFGameType?VACSecured=true?MaxPlayers=12?MinPlayers=12?AdminName=nd2spd?AdminPassword=passwordhere -log=server.log
Advertisement
Add Comment
Please, Sign In to add comment