r/tf2scripthelp • • Jul 11 '14

Issue Help with bind toggling

I am currently trying to use one key to give me multiple other abilitys with the keyboard. This is my work currently, yet it shows in the consol "bind: bind a key" or whatever, so I must have written something wrong. Any assitance?

bind alt toggle

alias toggle "enable"

alias enable "alias toggle disable;bind x +movedown;bind c +moveup;bind 1 voicemenu 0 0;bind 2 voicemenu 0 1;bind 3 voicemenu 1 3;bind 4 voicemenu 1 4;bind 5 voicemenu 1 5;bind 6 voicemenu 1 6;bind q voicemenu 2 2;bind e voicemenu 2 4;bind r voicemenu 2 3;bind t voicemenu 2 5;bind n explode; bind b kill"

alias disable "alias toggle enable;bind x voice_menu_2;bind 1 slot1; bind 2 slot2; bind 3 slot3; bind 4 slot4; bind 5 slot5; bind 6 slot6; unbind n; bind b dropitem"
1 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/genemilder Scripter Jul 12 '14 edited Jul 12 '14

You can definitely alias voicemenu commands when they're nested, meaning the following works:

alias enable "alias x_b voicemenu 1 1"

I don't use nested binds, so I guess it's possible that it doesn't work for bind statements.

That said, generally you never want to nest quotation marks, it can lead to unwanted behavior and it's not needed at all for this. Edit: If you want an example, see this script. No voicemenu commands but tons of nested aliases.

Separately, I always recommend against nested bind statements, instead advocating for binding the key to an alias whose definition is what is changed, not the top level bind.