Closed Leayal closed 4 months ago
I think most people are running the exe by double-clicking or dragging the palworldsettings.ini and I wanted to keep the window open so users can verify the tool worked as expected. Using input was the only way I could figure out how to do that.
I did just push a change so the interaction only happens on the EXE.
I also added an additional argument, --script
that can be added to the EXE to skip the interactions.
hopefully, that will work for you
Thank you for the change. It works great.
In case anyone wants the script:
To auto-generate the WorldOptions.sav
everytime they make changes to PalworldSettings.ini
, you can put .bat
file with script below into the root directory of the dedicated server (or put the script in the folder containing the PalServer.exe
file).
Everytime you want to make change to your .ini
file, run this script instead. The script will open .ini
with default text editor, and then will run the .exe tool after you close the text editor.
REM "%~dp0" (without double quotes) is a variable which is the full path to the directory containing the batch script file
SETLOCAL
@echo off
REM Full path to the PalWorldSettings.ini
SET "PALWORLD_SERVER_CONF_PATH=%~dp0Pal\Saved\Config\WindowsServer\PalWorldSettings.ini"
REM Full path to the DefaultPalWorldSettings.ini, usually can be found in the root directory of the dedicated server
SET "PALWORLD_SERVER_CONF_PATH_DEFAULT=%~dp0DefaultPalWorldSettings.ini"
REM Full path to the .exe tool
SET "PALWORLD_TOOL_WORLDOPTIONS_GENERATOR=%~dp0palworld-worldoptions.exe"
IF NOT EXIST "%~dp0Pal\Saved\Config\WindowsServer" (
mkdir "%~dp0Pal\Saved\Config\WindowsServer"
)
IF NOT EXIST "%PALWORLD_SERVER_CONF_PATH_DEFAULT%" (
GOTO TOTHEEND
)
IF NOT EXIST "%PALWORLD_SERVER_CONF_PATH%" (
copy /B /Y "%PALWORLD_SERVER_CONF_PATH_DEFAULT%" "%PALWORLD_SERVER_CONF_PATH%"
)
SET "PALWORLD_SERVER_SAVE_DIR=%~dp0Pal\Saved"
SET "PALWORLD_SERVER_SAVE_WORLD_DIR=%PALWORLD_SERVER_SAVE_DIR%\SaveGames\0"
FOR /D %%F in ("%PALWORLD_SERVER_SAVE_WORLD_DIR%\*") DO (
SET "PALWORLD_SERVER_SAVE_WORLD_DIR=%%F"
GOTO BREAK_FROM_LOOP
)
:BREAK_FROM_LOOP
REM Or use: start /WAIT "Palworld Server Configuration" "%windir%\system32\notepad.exe" "%PALWORLD_SERVER_CONF_PATH%"
REM To force using notepad to open the file
echo Opening DefaultPalWorldSettings.ini for editing.
echo Once you are done editing, close the text editor to trigger WorldOptions.sav generation.
start /WAIT "Palworld Server Configuration" "%PALWORLD_SERVER_CONF_PATH%"
echo Generating WorldOptions.sav...
start /WAIT /B "Generating WorldOptions.sav" "%PALWORLD_TOOL_WORLDOPTIONS_GENERATOR%" "%PALWORLD_SERVER_CONF_PATH%" --output "%PALWORLD_SERVER_SAVE_WORLD_DIR%" --script
:TOTHEEND
ENDLOCAL
The tool can't be used in automation scripts because this line blocks the tool from exitting after it's done its job as an usual CLI tool should.
If the tool is used in an automation script, it ruins the automation (usually the script writer prefer no interaction or little interaction as possible) as the script will have to wait for the tool before continue executing...while the tool waiting for user's input.
If it's possible, please remove that line, or adding a launch argument to disable this behavior.