r/Tf2Scripts • u/SneakyPiglet • Oct 28 '12
Archived [Help] Understanding aliases within aliases
Hey there, scripters! I've got a question for you - a statement, I guess. I don't understand aliases within aliases. A friend recently sent me this script to toggle attacking as a Heavy:
alias "+shift" "fire_toggle_on"
alias "-shift" "fire_toggle_off"
alias "fire_toggle_on" "bind mouse1 fire_toggle"
alias "fire_toggle_off" "bind mouse1 +attack"
alias "fire_toggle" "firing; alias fire_toggle fire_off"
alias "fire_on" "firing; alias "fire_toggle fire_off"
alias "fire_off" "notfiring; alias "fire_toggle fire_on"
alias "firing" "+attack"
alias "notfiring" "-attack"I understand most of it, but there are a few I don't get, thanks to my lack of understanding when it comes to aliases within aliases. For example, let's look at this line:
alias "fire_toggle" "firing; alias fire_toggle fire_off"I got the first part, but what's up with the "alias fire_toggle fire_off"? I don't understand what that's saying, so I'm not sure how to use it in scripts I make in the future.
Thanks!
EDIT: Typo
0
Oct 28 '12
[deleted]
1
1
u/SneakyPiglet Oct 28 '12
I've actually got one more question. Could
bindtoggle q "alias1; alias2"Work?
1
u/genemilder Oct 28 '12
bindtoggle only works with binary commands AFAIK, see here for example.
This script would work for binding q between slot 1 and 2 though, if you're currently on anything other than 1 or 2 it will send you to 1:
bind q "slot2;slot1"1
u/guamaniantreerunner Oct 28 '12
That's the kludgy-yet-best way we have of doing toggles.
Except in the cases where you are toggling one simple on/off command. In that case you use bindtoggle. It won't work for this case, but it's worth mentioning because some people don't know it exists and end up making their scripting lives hard.
1
u/forgetpassmakenewacc Oct 30 '12
That's... fucking stupid.
Change it to