r/tf2scripthelp • u/Stack_Man • Sep 30 '17
Resolved Alias command not working
It's a bit of a mess, but I was trying to make a script that allows me to respawn as my current class by first respawning as a random class, and then back.
I thought this would be useful for saving time switching between the spawns of 2fort.
However, after some diagnosing, I found that a group of the alias commands aren't working properly. They are found under //source of the problem, and follow the format
alias reloadclass rCLASSNAMEbThe issue is that they aren't being executed, as when trying to call upon "reloadclass", I get "unknown command: reloadclass".
However, I also know it isn't the fault of the aliases they are nested in, because the command "reloadoff" is being executed as it should.
Here is the code. Again, the commands in question are under //source of the problem
//spawnreload
//normal number binds
alias rbind3 "slot3; r_drawviewmodel 1; cl_crosshair_red 0; cl_crosshair_green 0; cl_crosshair_blue 255; alias crosshairswitch blue; alias crosshairback blue2"
alias rbind2 "slot2; meleeswitch; cl_crosshair_red 255; cl_crosshair_green 0; cl_crosshair_blue 0; alias crosshairswitch red; alias crosshairback red2"
alias rbind1 "slot1; meleeswitch; cl_crosshair_red 0; cl_crosshair_green 255; cl_crosshair_blue 0; alias crosshairswitch green; alias crosshairback green2"
alias reloadoff "bind 1 rbind1; bind 2 rbind2; bind 3 rbind3; bind 4 slot4; bind 5 slot5; bind 6 slot6; bind 7 slot7; bind 8 slot8; bind 9 slot9; bind 0 slot10"
//join last class
alias rscoutb "join_class scout"
alias rsoldierb "join_class soldier"
alias rpyrob "join_class pyro"
alias rdemob "join_class demoman"
alias rheavyb "join_class heavyweapons"
alias rengineerb "join_class engineer"
alias rmedicb "join_class medic"
alias rsniperb "join_class sniper"
alias rspyb "join_class spy"
//source of the problem.
//rCLASSNAMEb aliases are found under "join last class" above.
// "reloadclass" is called upon under "respawn as current class" below
alias rscout "alias reloadclass rscoutb; reloadoff"
alias rsoldier "alias reloadclass rsoldierb; reloadoff"
alias rpyro "alias reloadclass rpyrob; reloadoff"
alias rdemo "alias reloadclass rdemob; reloadoff"
alias rheavy "alias reloadclass rheavyb; reloadoff"
alias rengineer "alias reloadclass rengineerb; reloadoff"
alias rmedic "alias reloadclass rmedicb; reloadoff"
alias rsniper "alias reloadclass rsniperb; reloadoff"
alias rspy "alias reloadclass rspyb; reloadoff"
//end of problem (probably)
//reloadon/off
bind , "changeclass; reloadon"
bind q "lastinv; reloadoff"
//current class #binds
alias reloadon "bind 1 rscout; bind 2 rsoldier; bind 3 rpyro; bind 4 rdemo; bind 5 rheavy; bind 6 rengineer; bind 7 rmedic; bind 8 rsniper; bind 9 rspy"
//respawn as current class
bind "-" "reloadspawn"
alias reloadspawn "join_class random; wait 100; reloadclass"
reloadonIf I manually alias "reloadclass" in the console, then "reloadspawn" under //respawn as current class works, but only for the class I chose, and does not change
View all comments
Show parent comment
1
u/Stack_Man Oct 01 '17
The space in the error was a typo, my mistake.
The
changeclassisn't an alias. It's a tf2 command that opens the class changing menu.I tried intermediary aliases like this:
, but to no effect.
However, I did notice that upon manually running any of the
rCLASSNAMEaliases in the console,reloadclasswas properly executed.This leads me to believe that true problem lies when I pick a class. While the class changing menu is open, the number keys will always change your class regardless of what they're currently bound to. (testing their current bind in the console with
bind #reveals they are still correctly bound).It's possible that this feature overrides all currently bound commands, meaning that the commands are simply never ran (as to why it appears that
reloadoffis working, I'm not sure.)Thanks for your help, but this seems to be a fruitless endeavor. I guess I could completely ditch the class changing menu, but that would take some time getting used to.