r/Tf2Scripts • u/W1llSmith • Jul 23 '20
Answered How do I toggle configs?
How do I bind a button to toggle between different configs. If this is impossible then how would I bind a button to toggle one config. Also does this work with folders or just configs?
5
Upvotes
1
u/pdatumoj Jul 24 '20
You could have an alias in each config that includes all the setup operations for that config and then have your toggle call each of those aliases to accomplish the switch-over.
Alternately, I suppose you could get clever with aliases to build the file names for exec commands, but that would be slower than having things already loaded and ready to swap between them.
Might I ask what the end goal is?
1
u/Stack_Man Jul 24 '20
Like, switching between entire config files?
There's ways to cycle between different commands on one button, how many are you switching between? Is it the same for every class? What are the cfg's names?
1
u/tf2junior Jul 24 '20
Do you mean config as like a class config (binds and stuff) or a full graphics config (e.g. mastercomfig presets).
1
u/kurokinekoneko Jul 24 '20 edited Jul 24 '20
I created a script some months ago to have "modes" in my config.
Here is how to use it.
add a "modes" folder in your configIt will contain 3 important files :
See this file as a "librairy" : don't touch it.It define an alias "nextmode" for switching to the next mode.Each mode is an alias "mode1", "mode2", etc. Switching to next mode mean executing "modes/reset.cfg" then play "mode<next mode>".
It only loop on defined modes : if the next mode is not defined, it will only play "modes/reset.cfg" and the next mode will me "mode1".
Now we have to define our modes in "modes/modes.cfg" file.
Exemple :
( in this example, theses are exec commands and need the "modes/surf_server.cfg", "mode/mvm.cfg" or "mode/trade_server.cfg" to exist. )
Exemple :
Last thing to do is to decide how you'll play "nextmode" :
Don't use "nextmode" in your cfg files. Don't use "nextmode" or "modes/switcher.cfg" in your "<class>.cfg" files.
1
u/[deleted] Jul 24 '20 edited Jul 24 '20
I personally recommend adding a custom option for that, as a list. Like below.
(In user.scr, dont modify the one in tf/cfg, create one in custom folder/whatever/cfg)
It won't appear in the advanced options menu for some reason, but if you go to options, then multiplayer, and finally advanced, scroll to the bottom and you should see it. Just know that this value won't get saved, because it's not a cvar with the archive flag, but a command. If you want to learn more about the syntax, read the pre generated comments in settings.scr or user.scr in tf/cfg.
If you just want to stick to a bind, this is possible as well. Simply change the alias the key is binded to to a next state. E.g
It won't remember the state through game launches, but if the configs just bind and change archived cvars, that should work.