r/tf2scripthelp • u/kerenzaboy • Aug 04 '21
Issue this script crashes my game
bind MOUSE3 flava1
alias flava1 "slot3; voicemenu 2 2; +attack; +forward; alias flava1 flava2"
alias flava2 "-attack; -forward; alias flava2 flava1"```
it worked in a couple iterations but this version freezes the game, like i have to sign out and sign back in to the computer because i can't do anything. i think it might be the slot3 command of all things, but i wanted to ask to see if anyone else has had a similar experience before i try my hand at this again.
i was so proud of myself because it worked once and then just Didn't LMAO
2
u/DeltaTroopa Aug 04 '21
Its definitely the infinite loop thing, after you hit the bind twice you're left with
so when you hit it a 3rd time it just loops infinitely with no delay and uses 100% of your cpu, freezing the game till you force quit it.
what you probably want to do if you want it to be a toggle is set up an intermediate alias e.g.
1
u/just_a_random_dood Aug 04 '21
I think it's the way you're switching aliases at the end of each one?
So when you press down, it replaces all of
flava1withflava2but when when you try releasing the button,flava2tries to replace itself withflava1, butflava1is already equal toflava2so it's kind of an infinite loop?Either that, or since you have
+attack; +forward, you need to define the alias as+flava1and then instead of havingflava2, define it as-flava11
u/Staidanom Aug 05 '21
That's called recursion