Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
scifista42

Easy and fast config swap?

Recommended Posts

Let's say that I want to play certain wads with keyboard-only settings and autoaim on, and other wads with keyboard+mouse settings and autoaim off. I would like to be able to swap between the settings as easily as possible and anytime I want to. Ideally by pressing only one button anytime during the game itself - but that's most probably not possible yet (but I'd like it to be). What are my possibilities? I don't have an aversion to work with command line or batch files, or spending time setting things up - but at the end of the day, I'd like to be able to swap between configs with absolute minimum in-between steps. If the theoretical easiest way is not possible for some reason, I take the 2nd easiest, etc - in short, please advise me anyhow.

EDIT: Thanks to Ralphis's suggestion, I've found an incredibly good and convenient way to swap configs anytime during the game in ZDoom based engines - see this post.

Share this post


Link to post

You could have two config files, one for each setup, and change the filename to the source port's default config filename for the setup you want to use.

Share this post


Link to post

Thanks. Now, do I have any possibility to make the procedure easier than going into the source port's directory and manually renaming 2 files every time I want to do it?

Share this post


Link to post

Which engine? If it has ZDoom's console, you could always have two files and use the "exec" command to execute the config through console.

Like, you have config1.txt and config2.txt in the directory. You could just do console command "exec config1.txt" or "exec config2.txt"

Share this post


Link to post

Ralphis, that is awesome! Thanks a lot!

I've created 2 key binding configs, kbd.txt and mouse.txt.

This is the content of kbd.txt:

set mycfg 0
bind w "+lookup"
bind ctrl "+attack"
bind s "+lookdown"
bind x "+jump"
bind space "+use"
unbind a
unbind d
unbind f
echo "keyboard controls"
This is the content of mouse.txt:
set mycfg 1
bind space "+jump"
bind ctrl "+crouch"
bind f "+use"
bind a "+moveleft"
bind d "+moveright"
bind x "+attack"
bind w "+forward"
bind s "+back"
echo "mouse controls"
I've used 'set' to make a variable to keep track of the currently used confing. I've also used 'echo' to send a message to log, to inform myself that the binding change actually happened - I want to keep track of this information every time I do it in the game.

I've placed these files into ZDoom's and Zandronum's directories, and then I've binded 2 additional keys in ZDoom and Zandronum themselves:
bind [ "exec kbd.txt"
bind ] "exec mouse.txt"
bind p "test == $mycfg 1 "exec kbd.txt" "exec mouse.txt""
Pressing [ will change the layout to my preferred keyboard only, pressing ] will change the layout to keyboard+mouse, and pressing p will automatically swap to the other layout than the currently used one.

Works like a charm! Again, thanks for the suggestion, this is exactly what I wanted.

---

Eventually, I'd be interested to find ways how to simplify swapping configs in non-ZDoom engines too - PrBoom-plus, Eternity, 3DGE etc. Maybe it won't be as easy, but I take any suggestions to simplify it at least a little.

Share this post


Link to post

For other ports (and zdoom too), even including vanilla, there is the -config command line option that tells the game to use a specified config file instead of the default.

Share this post


Link to post

I've improved my setup. Now I have 3 "configs".

Kbd.txt rebinds the keyboard to my standard keyboarder's layout, disables freelook, enables autoaim and centers my view by default:

set mycfg 0
bind w "+lookup"
bind ctrl "+attack"
bind s "+lookdown"
bind x "+jump"
bind space "+use"
unbind a
unbind d
unbind e
echo "keyboard controls"
freelook 0
sv_noautoaim 0
crosshair 0
centerview
Mouse.txt rebinds the layout to WASD + mouse, still with to vertical freelook and with autoaim enabled: (it also centers my view by default)
set mycfg 1
bind space "+jump"
bind ctrl "+crouch"
bind e "+use"
bind a "+moveleft"
bind d "+moveright"
bind x "+attack"
bind w "+forward"
bind s "+back"
echo "mouse controls"
freelook 0
sv_noautoaim 0
crosshair 0
centerview
Mfree.txt rebinds the layout to WASD + mouse, with freelook and crosshair enabled and autoaim disabled:
set mycfg 2
bind space "+jump"
bind ctrl "+crouch"
bind e "+use"
bind a "+moveleft"
bind d "+moveright"
bind x "+attack"
bind w "+forward"
bind s "+back"
echo "freelook controls"
freelook 1
sv_noautoaim 1
crosshair -1
All 3 files (kbd.txt, mouse.txt, mfree.txt) are in my ZDoom's directory. I have made these bindings in my ZDoom:
bind p "exec kbd.txt"
bind [ "exec mouse.txt"
bind ] "exec mfree.txt"
This allows me to make an immediate switch between keyboard settings however I want to, I simply press the respective key (p, [, or ]). This is the ideal solution I was looking for. I thought it was worth posting here, for anyone who would like to try it / use it too.


!!!
EDIT: I have just found out that it will only work if I launch the port from its own directory, but not when I launch a wad in the source port via a context menu from a random folder on my computer. Maybe I will have to add absolute paths or embed all of the commands from the textfiles directly into the command line binding.
!!!

Share this post


Link to post

I did it. Here is the console code that makes it all work without directory-dependent textfiles:

bind p "set mycfg 0; bind w \"+lookup\"; bind ctrl \"+attack\"; bind s \"+lookdown\"; bind x \"+jump\"; bind space \"+use\"; unbind a; unbind d; unbind e; echo \"keyboard controls\"; freelook 0; sv_noautoaim 0; crosshair 0; centerview"
bind [ "set mycfg 1;bind space \"+jump\";bind ctrl \"+crouch\";bind e \"+use\";bind a \"+moveleft\";bind d \"+moveright\";bind x \"+attack\";bind w \"+forward\";bind s \"+back\";echo \"mouse controls\";freelook 0;sv_noautoaim 0;crosshair 0;centerview"
bind ] "set mycfg 2; bind space \"+jump\"; bind ctrl \"+crouch\"; bind e \"+use\"; bind a \"+moveleft\"; bind d \"+moveright\"; bind x \"+attack\"; bind w \"+forward\";bind s \"+back\";echo \"freelook controls\";freelook 1;sv_noautoaim 1;crosshair -1"

(of course, the particular bindings are still accustomized to my personal preferred keyboard controls)

I've actually ran into the limit of maximum characters on console prompt, so that I had to delete spaces after semicolons in order to make the command sequences fit on the line. But it works - everywhere, with every wad, and in ZDoom, Zandronum and GZDoom (after I've entered these binding into each of them), and I'm glad for that.

Share this post


Link to post

Why do you try to do it all via console? Couldn't you put it all in a few .cfgs, as long as you need them, and then exec them via a bind+alias? It worked for me when I was part of a Q2Arena clan (everyone had a bunch of aliases for RJs, taunts, item drops and the like), I'd be surprised if 15 years later Zdoom and its descendant still haven't copied that functionality.

Share this post


Link to post

Read my pre-previous post including the EDIT. Files in the port's directory are not found if I launch the port indirectly (by double clicking a wad or "Open With").

Share this post


Link to post
scifista42 said:

Read my pre-previous post including the EDIT. Files in the port's directory are not found if I launch the port indirectly (by double clicking a wad or "Open With").


How about "exec d:\doom\zdoom\keyboard.txt"?

Also, while individual commands have a maximum length, you can always cheat by using more aliases.

For example:

alias wasdmove "bind space \"+jump\"; bind ctrl \"+crouch\"; bind e \"+use\"; bind a \"+moveleft\"; bind d \"+moveright\"; bind x \"+attack\"; bind w \"+forward\"; bind s \"+back\""

then

bind [ "set mycfg 1; wasdmove; echo \"mouse controls\"; freelook 0; sv_noautoaim 0; crosshair 0; centerview"
bind ] "set mycfg 2; wasdmove; echo \"freelook controls\"; freelook 1; sv_noautoaim 1; crosshair -1"

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×