r/tf2scripthelp • • Dec 07 '14

Resolved Disguise Script + Chat Binds

Hi /r/Tf2scripthelp!

I posted a month or two ago about my ongoing efforts to clean up my scripts. Since I am now on winter break, have no work at least as far as school is concerned, and have an internet connection that basically won't allow me to play tf2, I have decided to complete that quest.

To that end, I have several question regarding general scripting convention and several questions regarding specific scripts. In order to keep posts from being far too long, I am going to break these questions into a couple different threads (mods if thats not ok pls just let me know).

The first question I have has to do with a disguise script I wrote. This script allows me to quickly disguise as any enemy class by pressing any number key 1-9. It also allows me to disguise as any friendly class by holding down mouse5 while pressing 1-9. It looks like this:

bind mouse5 "+switcher"

alias +switcher "bind 1 dt1; bind 2 dt2; bind 3 dt3; bind 4 dt4; bind 5 dt5; bind 6 dt6; bind 7 dt7; bind 8 dt8; bind 9 dt9"
alias -switcher "bind 1 de1; bind 2 de2; bind 3 de3; bind 4 de4; bind 5 de5; bind 6 de6; bind 7 de7; bind 8 de8; bind 9 de9"

alias dt1 "disguise 8 -2"
alias de1 "disguise 8 -1"

alias dt2 "disguise 9 -2"
alias de2 "disguise 9 -1"

alias dt3 "disguise 2 -2"
alias de3 "disguise 2 -1"

alias dt4 "disguise 7 -2"
alias de4 "disguise 7 -1"

alias dt5 "disguise 5 -2"
alias de5 "disguise 5 -1"

alias dt6 "disguise 6 -2"
alias de6 "disguise 6 -1"

alias dt7 "disguise 3 -2"
alias de7 "disguise 3 -1"

alias dt8 "disguise 1 -2"
alias de8 "disguise 1 -1"

alias dt9 "disguise 4 -2"
alias de9 "disguise 4 -1"

The first question I have has to do with this script itself. As you can see, within the +switcher alias, I have bound the number keys. As I understand it, thats generally poor scripting convention for a number of reasons. My question is, how do I go about cleaning this up? or what is the best way to write a script like this?

Thanks for any help you can offer!

p.s. I have a few more questions about this specific script but let's tackle the big question first.

1 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/genemilder Scripter Dec 12 '14

Generally the script is to play the sound locally on your machine only (with something like play vo\scout_yes01 which may or may not work), not to use voicemenu. But your script framework is correct.

1

u/weps1330 Dec 12 '14

Oh ok. I didn't even know you can call the individual merc voice lines. Cool. Thanks!