TF2 Script Issue

Post Reply
User avatar
Bench
Posts: 121
Joined: Sat Dec 24, 2016 8:22 pm
Location: surf_the_distance

TF2 Script Issue

Post by Bench »

So I was modifying a script for TF2 that would essentially allow the keys on my number pad have two bound commands. In order for this to work, I have an action key bound to toggle between each command to use. The issue is how the activator key would print the message in console for when you use the incorrect layout when using the bind command upon being pressed. It would print nine times when pressed, being as how I have nine keys with the multiple commands, I presume. If anyone has a fix, please help.

Text Being Spammed in Console
Spoiler

Code: Select all

bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
bind <key> [command] : attach a command to a key
Script
Spoiler

Code: Select all

alias defA "bind kp_end taunt 4"
alias defB "bind kp_downarrow say (????)?"
alias defC "bind kp_pgdn say Leaxeaus {C²°} :  bench tastes butt everyday"
alias defD "bind kp_leftarrow toggle cl_disablehtmlmotd"
alias defE "bind kp_5 say ( ?° ?? ?°)"
alias defF "bind kp_rightarrow say Listen here you fuck twat dick licker - Soup"
alias defG "bind kp_home toggle r_drawviewmodel"
alias defH "bind kp_uparrow say \(??   ??    ??)/"
alias defI "bind kp_pgup say --- ??•?•??"

alias keyA "bind kp_end keyAA"
alias keyB "bind kp_downarrow keyBB" 
alias keyC "bind kp_pgdn keyCC"
alias keyD "bind kp_leftarrow keyDD"
alias keyE "bind kp_5 keyEE"
alias keyF "bind kp_rightarrow keyFF"
alias keyG "bind kp_home keyGG"
alias keyH "bind kp_uparrow keyHH"
alias keyI "bind kp_pgup keyII"

alias keyAA "taunt 1"
alias keyBB "taunt 2"
alias keyCC "taunt 3"
alias keyDD "taunt 4"
alias keyEE "taunt 5"
alias keyFF "taunt 6"
alias keyGG "taunt 7"
alias keyHH "taunt 8"
alias keyII "taunt"

alias +keybinds "keyA; keyB; keyC; keyD; keyE; keyF; keyG; keyH; keyI"
alias -keybinds "defA; defB; defC; defD; defE; defF; defG; defH; defI"

bind kp_ins "+keybinds"
Last edited by Bench on Thu May 18, 2017 10:23 pm, edited 1 time in total.
Steam
Tickle: Hello, I'm tickle, & I'm a pedophile
Bench: (immediately & excited) I'm underage
User avatar
MoneyKidKing
Posts: 715
Joined: Thu Apr 10, 2014 12:15 am

Re: TF2 Script Issue

Post by MoneyKidKing »

From what I can tell, your issue is the location of your quotation marks. I would test the fixed code myself, but I don't want to mess with my own binds, so let me know if the following code works.
Spoiler
alias defA bind kp_end "taunt 4"
alias defB bind kp_downarrow "say (????)?"
alias defC bind kp_pgdn "say Leaxeaus {C²°} : bench tastes butt everyday"
alias defD bind kp_leftarrow "toggle cl_disablehtmlmotd"
alias defE bind kp_5 say "( ?° ?? ?°)"
alias defF bind kp_rightarrow "say Listen here you fuck twat dick licker - Soup"
alias defG bind kp_home "toggle r_drawviewmodel"
alias defH bind kp_uparrow "say \(?? ?? ??)/"
alias defI bind kp_pgup "say --- ??•?•??"

alias keyA bind kp_end "keyAA"
alias keyB bind kp_downarrow "keyBB"
alias keyC bind kp_pgdn "keyCC"
alias keyD bind kp_leftarrow "keyDD"
alias keyE bind kp_5 "keyEE"
alias keyF bind kp_rightarrow "keyFF"
alias keyG bind kp_home "keyGG"
alias keyH bind kp_uparrow "keyHH"
alias keyI bind kp_pgup "keyII"

alias keyAA "taunt 1"
alias keyBB "taunt 2"
alias keyCC "taunt 3"
alias keyDD "taunt 4"
alias keyEE "taunt 5"
alias keyFF "taunt 6"
alias keyGG "taunt 7"
alias keyHH "taunt 8"
alias keyII "taunt"

alias +keybinds "keyA;keyB;keyC;keyD;keyE;keyF;keyG;keyH;keyI"
alias -keybinds "defA;defB;defC;defD;defE;defF;defG;defH;defI"

bind kp_ins "+keybinds"
Last edited by MoneyKidKing on Thu May 18, 2017 11:24 pm, edited 2 times in total.
Shia Suprise
Spoiler
User avatar
fishermatt3552
Veteran
Posts: 326
Joined: Mon Apr 03, 2017 5:44 pm
Location: Canton, MI, USA

Re: TF2 Script Issue

Post by fishermatt3552 »

It seems your quotation marks are out of place

bind "key" "command"
Last edited by fishermatt3552 on Thu May 18, 2017 11:29 pm, edited 1 time in total.
User avatar
Bench
Posts: 121
Joined: Sat Dec 24, 2016 8:22 pm
Location: surf_the_distance

Re: TF2 Script Issue

Post by Bench »

Didn't fix the problem with the action key and now the number pad keys will do the secondary command (taunt) without using the action key. Holding the action key and pressing the key has no effect.

EDIT: Quotes did not solve the problem.

My quote location was correct since I have <alias script "bind key say text"> instead of <alias script bind key "say text">. This is because the quote is separating the whole bind, key, and say from the alias. Having the quotes would be incorrect in how it would make be only say. Fuck this hurts my brain.
Last edited by Bench on Fri May 19, 2017 1:17 am, edited 3 times in total.
Steam
Tickle: Hello, I'm tickle, & I'm a pedophile
Bench: (immediately & excited) I'm underage
User avatar
MoneyKidKing
Posts: 715
Joined: Thu Apr 10, 2014 12:15 am

Re: TF2 Script Issue

Post by MoneyKidKing »

I mean, the other option is to just go overkill on the quotations.
Spoiler
alias "defA" "bind kp_end" "taunt 4"
alias "defB" "bind kp_downarrow" "say (????)?"
alias "defC" "bind kp_pgdn" "say Leaxeaus {C²°} : bench tastes butt everyday"
alias "defD" "bind kp_leftarrow" "toggle cl_disablehtmlmotd"
alias "defE" "bind kp_5" "say"( ?° ?? ?°)"
alias "defF" "bind kp_rightarrow" "say Listen here you fuck twat dick licker - Soup"
alias "defG" "bind kp_home" "toggle r_drawviewmodel"
alias "defH" "bind kp_uparrow" "say \(?? ?? ??)/"
alias "defI" "bind kp_pgup" "say --- ??•?•??"

alias "keyA" "bind kp_end" "taunt 1"
alias "keyB" "bind kp_downarrow" "taunt 2"
alias "keyC" "bind kp_pgdn" "taunt 3"
alias "keyD" "bind kp_leftarrow" "taunt 4"
alias "keyE" "bind kp_5" "taunt 5"
alias "keyF" "bind kp_rightarrow" "taunt 6"
alias "keyG" "bind kp_home" "taunt 7"
alias "keyH" "bind kp_uparrow" "taunt 8"
alias "keyI" "bind kp_pgup" "taunt"

alias +keybinds "keyA; keyB; keyC; keyD; keyE; keyF; keyG; keyH; keyI"
alias -keybinds "defA; defB; defC; defD; defE; defF; defG; defH; defI"

bind kp_ins "+keybinds"
Last edited by MoneyKidKing on Fri May 19, 2017 3:15 am, edited 4 times in total.
Shia Suprise
Spoiler
Mitch
Server Admin
Posts: 603
Joined: Thu Feb 23, 2012 1:41 am

Re: TF2 Script Issue

Post by Mitch »

Theres a small trick to doing binds, you will need to creat .cfg files that have each bind in it, and make the aliases exec the cfg instead. This is how I would do it in cs:s.
Image
User avatar
Bench
Posts: 121
Joined: Sat Dec 24, 2016 8:22 pm
Location: surf_the_distance

Re: TF2 Script Issue

Post by Bench »

Issue has been resolved, thread no longer needed.
Steam
Tickle: Hello, I'm tickle, & I'm a pedophile
Bench: (immediately & excited) I'm underage
Post Reply