FYI You can just go into doorstop_config.ini and change enabled=true to enabled=false (and vice-versa) each time you want to play with / without mods instead of using this batch process!
I made this because a) I was curious if it could be done, and b) I prefer a long complicated setup and then a super easy to use method to changing the text files each time! That is just personal preference though
kudos for developing this in an almost esoteric language like windows batch/cmd ;-) I was playing around with the idea myself but now I'll take a look at "previous work" first. :-)
Two notes:
https://github.com/lauren-mods/Bepswitch is error404 now.
instead of editing doorstop_config.ini I recommend just renaming winhttp.dll instead. It's required on windows to inject BepInEx into Valheim in the first place. -> just editing doorstop_config doesn't disable BepInEx completely. At least at the start it still gets injected into the VH process and only unloads(?) after reading the config file (or remains loaded but does nothing anymore?).
With the upcoming (sometime) Mistlands I thought I'd give Bepswitch a try since lots of mods probably won't work immediately after Mistlands is released. Downloaded it, installed as instructed, ran .bat file, selected option 1 and viola I was in the game without Bepinex or any mods running. Quit game, ran .bat file and selected option 2, it said I'm now modded or something of that nature but when I loaded the game it was still vanilla. Tried again, same result. I went into the doorstop_config.ini file to set enable=true and the .ini file it created was empty. Now I can't get Bepinex or any mods to run. Any ideas on how to reverse this short of wiping everything and starting over?
I tried to replicate the issue, but I didn't get an empty ini. Would it be possible for you to try again and see if it was a one time thing? Maybe Bepinex needed to be updated or something anyway?
Also, FYI, you can find the doorstop_config.ini inside the Bepinex pack (https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/) so if you want you can replace only that file with a clean copy.
The idea behind this really inspired me, so I decided to go the extra mile with it.
I made a batch code that switches between 9 different mod profiles with a menu that shows numbers from 0 to 9 (0 is vanilla) There isn't any part of your code that I used while making it, but I used the idea of changing doorstop_config.ini using batch.So I will be giving credit to you when I uploadit to nexus an hour later.
As a thank you, I want to show you a way of making it so you don't have to press enter after selecting an option in the menu. You can edit it to have as many options as you want, like this: CHOICE /N /C:1234567890qw /M "Please press a button (a number or q/w)"
You have to make errorlevel list in reverse using numbers for it to work. It should start with the number of options and end with one. Like this:
IF ERRORLEVEL ==12 DoSomething IF ERRORLEVEL ==11 DoSomething IF ERRORLEVEL ==10 DoSomething IF ERRORLEVEL ==9 DoSomething ......... IF ERRORLEVEL ==1 DoSomething
@echo off :start echo ========================= echo How do you want to play? echo ========================= echo - echo 1) Vanilla echo 2) Modded (enable Bepinex) echo -
CHOICE /N /C:12 /M "Please press a number (1 or 2)" IF ERRORLEVEL ==2 GOTO modded IF ERRORLEVEL ==1 GOTO vanilla
:vanilla echo ========================= powershell -Command "(gc doorstop_config.ini) -replace 'enabled=true', 'enabled=false' | Out-File -encoding ASCII doorstop_config.ini" echo You're now playing Vanilla Valheim! goto exit :modded powershell -Command "(gc doorstop_config.ini) -replace 'enabled=false', 'enabled=true' | Out-File -encoding ASCII doorstop_config.ini" echo ========================= echo You're now playing modded Valheim! goto exit :exit echo - echo This window will now close. PAUSE @exit
Thank you that's so kind and polite of you! Using the error level method is a really cool idea. Thank you for explaining that to me, I'll definitely use that in the future. I just saw your mod uploaded today and thought it looks really cool! I really like the ability to set profiles
Love the idea, thanks for your effort. But unless I'm missing something, your batch file never "exits"???? Pressing either 1 or 2 and [Enter] changes the doorstop_config.ini just fine, but then goes back to the the beginning of the batch file (i.e. goto start) and never ends??? Also if you press any other key other than 1 or 2 and [Enter], nothing gets changed, and it echoes "states" "You're now playing Vanilla Valheim!" regardless because its the first option if neither 1 or 2 is entered. You need a 3rd option (i.e. QUIT), and some simple logic to handle that exception. It's easily fixable, I did in just a few minutes. Not criticizing, just pointing it out. Thanks
Yeah, I got it to go back to start in case ppl want to leave it open for bug testing etc. I get that that might seem odd though! I didn't realise that if you put an invalid option in it says 'You are now playing vanilla' though! I'll try and figure that out next
EDIT: I've fixed that now, and also added in a closing mechanism (in 2.1) thanks for the input!
Hi there! Just to check, you're basically replacing true/false in doorstop .INI file?
Why not just use one of many ways to replace the string / line inside the textual files? Here is a nice stack overflow Q/A with dozen possible solutions: https://stackoverflow.com/questions/60034/how-can-you-find-and-replace-text-in-a-file-using-the-windows-command-line-envir
Also, your instructions say to edit "doorstop.ini" while I assume you ment "doorstop_config.ini"
yes, it just switches from true to false :) Thanks! Yeah I did look into that, but from what I understood it would replace all instances of 'false' rather than just the first one? ooops yeah I did mean doorstop_config.ini!
16 comments
You can just go into doorstop_config.ini and change enabled=true to enabled=false (and vice-versa) each time you want to play with / without mods instead of using this batch process!
I made this because a) I was curious if it could be done, and b) I prefer a long complicated setup and then a super easy to use method to changing the text files each time! That is just personal preference though
kudos for developing this in an almost esoteric language like windows batch/cmd ;-)
I was playing around with the idea myself but now I'll take a look at "previous work" first. :-)
Two notes:
doorstop_config.ini
I recommend just renamingwinhttp.dll
instead. It's required on windows to inject BepInEx into Valheim in the first place. -> just editing doorstop_config doesn't disable BepInEx completely. At least at the start it still gets injected into the VH process and only unloads(?) after reading the config file (or remains loaded but does nothing anymore?).Downloaded it, installed as instructed, ran .bat file, selected option 1 and viola I was in the game without Bepinex or any mods running.
Quit game, ran .bat file and selected option 2, it said I'm now modded or something of that nature but when I loaded the game it was still vanilla.
Tried again, same result. I went into the doorstop_config.ini file to set enable=true and the .ini file it created was empty.
Now I can't get Bepinex or any mods to run.
Any ideas on how to reverse this short of wiping everything and starting over?
I reinstalled Bepinex and that fixed it, left this here so you'd be aware of the issue....
I tried to replicate the issue, but I didn't get an empty ini. Would it be possible for you to try again and see if it was a one time thing? Maybe Bepinex needed to be updated or something anyway?
Also, FYI, you can find the doorstop_config.ini inside the Bepinex pack (https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/) so if you want you can replace only that file with a clean copy.
I made a batch code that switches between 9 different mod profiles with a menu that shows numbers from 0 to 9 (0 is vanilla)
There isn't any part of your code that I used while making it, but I used the idea of changing doorstop_config.ini using batch. So I will be giving credit to you when I upload it to nexus an hour later.
As a thank you, I want to show you a way of making it so you don't have to press enter after selecting an option in the menu. You can edit it to have as many options as you want, like this:
CHOICE /N /C:1234567890qw /M "Please press a button (a number or q/w)"
You have to make errorlevel list in reverse using numbers for it to work. It should start with the number of options and end with one. Like this:
IF ERRORLEVEL ==12 DoSomething
IF ERRORLEVEL ==11 DoSomething
IF ERRORLEVEL ==10 DoSomething
IF ERRORLEVEL ==9 DoSomething
.........
IF ERRORLEVEL ==1 DoSomething
@echo off
:start
echo =========================
echo How do you want to play?
echo =========================
echo -
echo 1) Vanilla
echo 2) Modded (enable Bepinex)
echo -
CHOICE /N /C:12 /M "Please press a number (1 or 2)"
IF ERRORLEVEL ==2 GOTO modded
IF ERRORLEVEL ==1 GOTO vanilla
:vanilla
echo =========================
powershell -Command "(gc doorstop_config.ini) -replace 'enabled=true', 'enabled=false' | Out-File -encoding ASCII doorstop_config.ini"
echo You're now playing Vanilla Valheim!
goto exit
:modded
powershell -Command "(gc doorstop_config.ini) -replace 'enabled=false', 'enabled=true' | Out-File -encoding ASCII doorstop_config.ini"
echo =========================
echo You're now playing modded Valheim!
goto exit
:exit
echo -
echo This window will now close.
PAUSE
@exit
Using the error level method is a really cool idea. Thank you for explaining that to me, I'll definitely use that in the future.
I just saw your mod uploaded today and thought it looks really cool! I really like the ability to set profiles
I didn't realise that if you put an invalid option in it says 'You are now playing vanilla' though! I'll try and figure that out next
EDIT: I've fixed that now, and also added in a closing mechanism (in 2.1) thanks for the input!
Why not just use one of many ways to replace the string / line inside the textual files? Here is a nice stack overflow Q/A with dozen possible solutions:
https://stackoverflow.com/questions/60034/how-can-you-find-and-replace-text-in-a-file-using-the-windows-command-line-envir
Also, your instructions say to edit "doorstop.ini" while I assume you ment "doorstop_config.ini"
Thanks! Yeah I did look into that, but from what I understood it would replace all instances of 'false' rather than just the first one?
ooops yeah I did mean doorstop_config.ini!