jooonior / tf2-loadouts-script

Loadout specific settings and a resup bind that knows which loadout you're on.
32 stars 2 forks source link

Loadout specific scripts are affecting all classes. #10

Closed billw1 closed 1 year ago

billw1 commented 1 year ago

I have set up the loadout specific settings like the medic example provided but it applies to every class. Is this a bug or limitation? Do I need to "undo" the settings in every other class loadout?

billw1 commented 1 year ago

I'm sure its a limitation because the script couldn't know what settings need to be reverted. Although, if you're familiar with mastercomfig's setup, there's a file called game_overrides.cfg which should be used to reset settings when changing classes; however, its not working here. I'm guessing that game_overrides is execed and then loadouts.config.X gets execed.. overriding it.

jooonior commented 1 year ago

Using game_overrides.cfg should work, it gets exec'd before every class CFG. Reset the loadout.cfg.X aliases there. That will effectively create a "defeault value", which you can then override in selected class CFGs.

jooonior commented 1 year ago

oops, didn't mean to close

billw1 commented 1 year ago

Okay thanks. It may be a good idea to direct users to do something like this in their class switch file (game_overrides.cfg) Most people should be using mastercomfig anyway

//default settings
bind mouse1 +attack
bind mouse2 +attack2
bind "MWHEELDOWN" "slot1"
bind "MWHEELUP" "slot2"
bind "MOUSE3" "slot3"
bind "mouse4" "+use_action_slot_item"
bind "mouse5" "+voicerecord"
sensitivity 1.2
viewmodel_fov 72
m_filter 0
cl_crosshair_scale 50

//reset loadout settings on class switch
alias loadouts.cfg.A
alias loadouts.cfg.B
alias loadouts.cfg.C
alias loadouts.cfg.D

without the second block there, the top block will not override commands saved in the loadout.cfg.X aliases. For example if scout.cfg loadouts.cfg.B binds mouse2 to something, it will be applied to every class - at least with my setup (mastercomfig)

jooonior commented 1 year ago

Thanks for the input. What seems obvious to me, because I know the internals of the script, might not be so clear to others. I've added a note about resetting the aliases to README (see cd0d9d4). Would you say it's enough or should I be more explicit?

jooonior commented 1 year ago

without the second block there, the top block will not override commands saved in the loadout.cfg.X aliases

All the script does in regards to this is calling loadout.cfg.X when changing to loadout X, what those aliases do is entirely up to you, so this is the expected behavior.

Actually this seems like a good thing to mention in README.

billw1 commented 1 year ago

I don't know. to me it seems counter intutive that the same aliases are applied to every class. Why would I ever want my settings from "loadout B" to apply to both soldier and scout. I thought this reset setting would already be in place as part of loadouts.class which we are instructed to put in every class.cfg

jooonior commented 1 year ago

Problem is that loadouts.class needs to call loadout.cfg.X to apply the settings when changing classes, otherwise you would need to change loadout for that to happen. Resetting them here would break this. I could add something like loadouts.cfg.reset but that is nothing users can't easily do themselves.

Also technically someone might want to have the same loadout cfg for all classes.

billw1 commented 1 year ago

is there a limit on aliases? why not loadouts.cfg.scout.B?

jooonior commented 1 year ago

I feel like that would add unnecessary complexity, since same effect is achieved by setting the shared aliases in each class cfg (and that's basically what the script would do to support these new aliases).

jooonior commented 1 year ago

What do you think about updated README?

billw1 commented 1 year ago

I think you should specify that the aliases need to be reset, not just the settings that were changed

billw1 commented 1 year ago

I think most people would assume that the loadout aliases are class specific, since you show them to be this way in the example. If someone follows the example exactly, they will have this medic config on every class.

jooonior commented 1 year ago

I think you should specify that the aliases need to be reset, not just the settings that were changed

3acc167

jooonior commented 1 year ago

I think most people would assume that the loadout aliases are class specific, since you show them to be this way in the example. If someone follows the example exactly, they will have this medic config on every class.

Most people would probably use them in class specific way (which makes the example relevant), but I don't want to add 36 new loadout.cfg.CLASS.X aliases for reasons mentioned earlier. Instead I'm trying to explain how they can set it up using the shared aliases. Hopefully the new README will help them do just that.