Alias: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Changed "console" link to "Developer Console")
(add notice about recursive quoting)
Line 1: Line 1:
An alias is a [[Developer Console|console]] command that invokes other commands. Aliases will only act for the game session in which they are called upon in; however, binds in an alias can last if your config.cfg is not set to read only. It is common for aliases to be defined in the autoexec.cfg file, or, in the case of [[Team Fortress 2]], in the class config files that are executed when a class is chosen
An alias is a [[Developer Console|console]] command that invokes other commands. Aliases will only act for the game session in which they are called upon in; however, binds in an alias can last if your config.cfg is not set to read only. It is common for aliases to be defined in the autoexec.cfg file, or, in the case of [[Team Fortress 2]], in the class config files that are executed when a class is chosen<ref>adsf.</ref>


An alias can have two states, + and -
An alias can have two states, + and -
Line 16: Line 16:
  alias "FoVxIN" "FoVx90"
  alias "FoVxIN" "FoVx90"
  alias "FoVxOUT" "FoVx90"
  alias "FoVxOUT" "FoVx90"
{{warning|An alias doesn't work if the command it is set to invoke ''itself'' has quotation marks. ({{ent|alias}} does not support quotation marks inside quotation marks.)}}
alias healthpls "ent_fire !self addoutput "health 200"" //does not work
{{workaround|Create a separate file containing that lone command and set alias to {{ent|exec}} the file.}}
//This is the only line in file health_wrapper.cmd:
ent_fire !self addoutput "health 200"
alias healthpls "exec health_wrapper.cmd" //works





Revision as of 08:46, 10 June 2021

An alias is a console command that invokes other commands. Aliases will only act for the game session in which they are called upon in; however, binds in an alias can last if your config.cfg is not set to read only. It is common for aliases to be defined in the autoexec.cfg file, or, in the case of Team Fortress 2, in the class config files that are executed when a class is chosen<ref>adsf.</ref>

An alias can have two states, + and -

Examples

alias "+ThirdPerson" "ThirdPerson"
alias "-ThirdPerson" "FirstPerson"
alias "ZoomON"		"+zoom; alias ZoomToggle ZoomOFF"
alias "ZoomOFF"		"-zoom; alias ZoomToggle ZoomON"
alias "ZoomToggle"	"ZoomON"
alias "FoVx85" "FoV 85; alias FoVxIN FoVx85; alias FoVxOUT FoVx90"
alias "FoVx90" "FoV 90; alias FoVxIN FoVx85; alias FoVxOUT FoVx95"
alias "FoVx95" "FoV 95; alias FoVxIN FoVx90; alias FoVxOUT FoVx95"
alias "FoVxIN" "FoVx90"
alias "FoVxOUT" "FoVx90"
Warning.pngWarning:An alias doesn't work if the command it is set to invoke itself has quotation marks. (alias does not support quotation marks inside quotation marks.)
alias healthpls "ent_fire !self addoutput "health 200"" //does not work
PlacementTip.pngWorkaround:Create a separate file containing that lone command and set alias to exec the file.
//This is the only line in file health_wrapper.cmd:
ent_fire !self addoutput "health 200"
alias healthpls "exec health_wrapper.cmd" //works


See Also

Console Command List