r/Tf2Scripts • u/mrstork89 • 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
View all comments
Show parent comment
1
u/KatenGaas Oct 24 '19 edited Oct 24 '19
Haha no problem. Honestly, I don't really where I started. I've just been on this sub for a couple years, helping people and writing my own scripts. I should mention though that I am a "regular" programmer too.
I think the biggest thing is just trying to understand other people's scripts, and using the tricks you see in your own.
Like, when you want to actively toggle the viewmodel, you know you need a variable alias to correctly turn it off or on based on which slot you are. So I put the r_drawviewmodel 1 in when we are on slot3, and viewmodel_mwheel to match the state of the capslock_toggle when we are on slot1 or 2.
Edit: I did write a basic guide to hiding TF2 viewmodels a while back. But there's probably more general guides too.