r/Tf2Scripts • • Oct 24 '19

Satisfied How to Toggle Draw Viewmodel Script with a button?

bind "r" "r_drawviewmodel 1;slot3"
bind mwheelup "slot1;r_drawviewmodel 0"
bind mwheeldown "slot2;r_drawviewmodel 0"

Now I want this r_drawviewmodel to remain "1" when I press Capslock and go back to being controlled by the keyboard buttons when I press again(capslock light turns off) or as it is above, basically revert back as above.

7 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/KatenGaas Oct 24 '19

You're correct. If the game switches your weapon for you (either by dying, or by placing with RR, or throwing jarate, running out of ammo, etc.) the script doesn't notice that. It's an unfortunate limitation of scripting, but scripts only notice active inputs (e.g. from your keyboard).

You could spend a lot of time and effort on workarounds if you wanted to, though. Like, in this case, you could say: if I'm on slot1, and I press right click, then turn viewmodel on. But then you'd also need the script to know which loadout you're on, so you need to bind your loadouts to buttons, and incorporate that into the script.. You can see where I'm going with this. It's generally more worth to just "deal with it"; e.g. you could get used to scrolling up after placing a building like that, to make the wrench visible.

1

u/mrstork89 Oct 24 '19

It's better to just deal with it, but for engi it's a enteral part of the class or at least for me to do it, so it's better to turn on the viewmodels