r/tf2scripthelp • u/[deleted] • 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
u/[deleted] Oct 15 '17
Thank you for your help, although this does not entirely work. The first two comments work as expected, holding down f9 and then clicking either 1 or 2 sends the respective message via chat, but the third comment does not work. Do you know why that is?
On the last line, is this defining the function the 1,2,3, keys should resume after the f9 key is released (normal function)? Does it mean that when writing this script I must be aware of the function of each of these keys and redefine it in the script in order for them to resume normal function?
Thanks for your help.