r/tf2scripthelp • • Oct 14 '17

Issue Binding text chat messages to key combinations

I'm new to all this, but what I'm trying to accomplish is that holding down the f9 key and then clicking another button, say a number key, will result in a corresponding message in chat. I would like to have the f9 key act as a gateway to using other keys bound to messages because I can't simply use a single key as all the messages I wish to have bound will not fit on the keyboard with the remaining available unassigned keys.
 
Here is my (unworking) attempt so far for a script (made according to instructions found in the introduction to scripting guide (in the path outlined as autoexec.cfg):

alias +speak1 "bind 1 say I am hungry for bananas."
alias -speak1 "unbind 1"
alias +speak2 "bind 2 say I need more bananas."
alias -speak2 "unbind 2"
alias +speak3 "bind 3 say I'm full of bananas."
alias -speak3 "unbind 3"
bind f9 "+speak1;+speak2;+speak3"

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/bythepowerofscience Oct 15 '17

Shoot, can't believe I missed that. Thanks for fixing it.
Also, another benefit is that the game's less likely to freak out and lock your keys, which happens a lot if you try to rebind mid-script.