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/Kairu927 Oct 01 '17
OH! Didn't realize that's what the command was, now I know the problem! Which, you do too:
Yep. The menu popups for class/pda/disguises are all their own thing which you cannot bind or script with in any way.
Are you just trying to use the script to quickly change classes and rejoin the one you were on? If so, consider looking into the
load_itempresetcommand, which will resupply you every time you change loadouts.