Difference between revisions of "Alias"
m (grammar) |
m (removed mentions of iVerb) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
===Standard Alias=== | ===Standard Alias=== | ||
− | You can add multiple functionalities to an alias, there is no limit, so long as the commands do not act as a script and follow the rules for both SRC and | + | You can add multiple functionalities to an alias, there is no limit, so long as the commands do not act as a script and follow the rules for both SRC and the challenge mode leaderboards. |
====Format==== | ====Format==== | ||
Line 30: | Line 30: | ||
An action command consists of two aliases of the same name, differentiated by the prefix <code>+</code> or <code>-</code>. Binding a key to the <code>+</code> variant will keep the functionality active while the button is held down. Releasing the key enacts the <code>-</code> variant. | An action command consists of two aliases of the same name, differentiated by the prefix <code>+</code> or <code>-</code>. Binding a key to the <code>+</code> variant will keep the functionality active while the button is held down. Releasing the key enacts the <code>-</code> variant. | ||
− | <pre style="color:red">Note: | + | <pre style="color:red">Note: CM rules forbid binding of multiple actions to one key, including using aliases. Read more below.</pre> |
− | [https:// | + | [https://rules.portal2.sr/ Rules doc] |
====Format==== | ====Format==== | ||
Line 41: | Line 41: | ||
=Common Examples= | =Common Examples= | ||
− | {{P2_Video|url=https://www.youtube.com/watch?v=9jWLC3XINiY|time=0|desc=Video with common examples and | + | {{P2_Video|url=https://www.youtube.com/watch?v=9jWLC3XINiY|time=0|desc=Video with common examples and explanations}} |
Examples included in this video on execs: | Examples included in this video on execs: | ||
− | *[https:// | + | *[https://rules.portal2.sr/ Challenge Mode Rules] |
− | *[https://www.speedrun.com/Portal_2 Speedrun.com Rules (Click on "View Rules)] | + | *[https://www.speedrun.com/Portal_2 Speedrun.com Rules (Click on "View Rules")] |
*[https://nekz.me/cvars/portal-2 NeKz cvars Portal 2 List] | *[https://nekz.me/cvars/portal-2 NeKz cvars Portal 2 List] | ||
*[https://github.com/p2sr/SourceAutoRecord/blob/master/doc/cvars.md SAR cvars] | *[https://github.com/p2sr/SourceAutoRecord/blob/master/doc/cvars.md SAR cvars] | ||
Line 52: | Line 52: | ||
==Portal Funneling (Uses SAR)== | ==Portal Funneling (Uses SAR)== | ||
+ | <pre style="color:red> | ||
+ | Changing the value of portal funneling is banned in all categories other than CM. | ||
+ | </pre> | ||
+ | |||
*1st Press: Portal Funneling off, value written to SAR HUD text element | *1st Press: Portal Funneling off, value written to SAR HUD text element | ||
*2nd Press: Portal Funneling on, value written to SAR HUD text element | *2nd Press: Portal Funneling on, value written to SAR HUD text element | ||
Line 57: | Line 61: | ||
Change alias that swaps the values of Portal Funneling. SAR 1.12.3+ required. | Change alias that swaps the values of Portal Funneling. SAR 1.12.3+ required. | ||
− | + | sar_alias funnelingOff "sar_alias funnelingChange funnelingOn; sv_player_funnel_into_portals 0; sar_hud_set_text 0 Portal Funneling: #FF5555OFF" | |
− | sar_alias funnelingOff "sar_alias funnelingChange funnelingOn; sv_player_funnel_into_portals 0; sar_hud_set_text 0 Portal Funneling: #FF5555OFF" | + | sar_alias funnelingOn "sar_alias funnelingChange funnelingOff; sv_player_funnel_into_portals 1; sar_hud_set_text 0 Portal Funneling: #55FF55ON" |
− | sar_alias funnelingOn "sar_alias funnelingChange funnelingOff; sv_player_funnel_into_portals 1; sar_hud_set_text 0 Portal Funneling: #55FF55ON" | + | funnelingOn // on by default, replace with funnelingOff to be off by default |
− | funnelingOn // on by default, replace with funnelingOff to be off by default | + | bind <key> funnelingChange |
− | bind <key> funnelingChange | ||
− | |||
==Low Sensitivity (Uses SAR)== | ==Low Sensitivity (Uses SAR)== | ||
Line 70: | Line 72: | ||
Toggle bind that lowers sensitivity for seamshots. SAR 1.12.3+ required. | Toggle bind that lowers sensitivity for seamshots. SAR 1.12.3+ required. | ||
− | + | sar_function resetSens "sensitivity $normalSens" | |
− | sar_function resetSens "sensitivity $normalSens" | + | sar_function captureSens "svar_from_cvar normalSens sensitivity" |
− | sar_alias lowSensOff "sar_alias lowSensToggle lowSensOn; resetSens" | + | sar_alias lowSensOff "sar_alias lowSensToggle lowSensOn; resetSens" |
− | sar_alias lowSensOn "sar_alias lowSensToggle lowSensOff; | + | sar_alias lowSensOn "sar_alias lowSensToggle lowSensOff; captureSens; sensitivity 0.01" |
− | lowSensOff | + | captureSens; lowSensOff |
− | bind <key> lowSensToggle | + | bind <key> lowSensToggle |
− | |||
==Ambient Light/Fullbright== | ==Ambient Light/Fullbright== | ||
Line 84: | Line 85: | ||
Change alias that switches between different values of ambient light. Used to combat video compression on Turret Factory and sometimes Catapult Block. | Change alias that switches between different values of ambient light. Used to combat video compression on Turret Factory and sometimes Catapult Block. | ||
− | + | alias ambientOff "alias ambientChange ambientOn; mat_ambient_light_r 0; mat_ambient_light_g 0; mat_ambient_light_b 0" | |
− | alias ambientOff "alias ambientChange ambientOn; mat_ambient_light_r 0; mat_ambient_light_g 0; mat_ambient_light_b 0" | + | alias ambientOn "alias ambientChange ambientOff; mat_ambient_light_r .07; mat_ambient_light_g .07; mat_ambient_light_b .07" |
− | alias ambientOn "alias ambientChange ambientOff; mat_ambient_light_r .07; mat_ambient_light_g .07; mat_ambient_light_b .07" | + | ambientOff // Off by default, replace with ambientOn to be on by default |
− | ambientOff // Off by default, replace with ambientOn to be on by default | + | bind <key> ambientChange |
− | bind <key> ambientChange | ||
− | |||
==Dialogue== | ==Dialogue== | ||
Line 97: | Line 96: | ||
Change alias that toggles between making dialogue silent and bringing values back up to default | Change alias that toggles between making dialogue silent and bringing values back up to default | ||
− | + | alias dialogueFull "alias dialogueChange dialogueMute; snd_setmixer potatosVO vol .4; snd_setmixer gladosVO vol .7; snd_setmixer announcerVO vol .7; snd_setmixer wheatleyVO vol .7; snd_setmixer caveVO vol .88; snd_setmixer coreVO vol .75" | |
− | alias dialogueFull "alias dialogueChange dialogueMute; snd_setmixer potatosVO vol .4; snd_setmixer gladosVO vol .7; snd_setmixer announcerVO vol .7; snd_setmixer wheatleyVO vol .7; snd_setmixer caveVO vol .88; snd_setmixer coreVO vol .75" | + | alias dialogueMute "alias dialogueChange dialogueFull; snd_setmixer potatosVO vol .01; snd_setmixer gladosVO vol .01; snd_setmixer announcerVO vol .01; snd_setmixer wheatleyVO vol .01; snd_setmixer caveVO vol .01; snd_setmixer coreVO vol .01" |
− | alias dialogueMute "alias dialogueChange dialogueFull; snd_setmixer potatosVO vol .01; snd_setmixer gladosVO vol .01; snd_setmixer announcerVO vol .01; snd_setmixer wheatleyVO vol .01; snd_setmixer caveVO vol .01; snd_setmixer coreVO vol .01" | + | dialogueFull // replace with dialogueMute to be muted by default |
− | dialogueFull // replace with dialogueMute to be muted by default | + | bind <key> dialogueChange |
− | bind <key> dialogueChange | ||
− | |||
==Toggle duck== | ==Toggle duck== | ||
Line 110: | Line 107: | ||
Change alias that toggles the duck functionality (crouching). Useful for Coop Any% runs. | Change alias that toggles the duck functionality (crouching). Useful for Coop Any% runs. | ||
− | + | alias -toggleDuck "alias toggleDuck +toggleDuck; -duck" | |
− | alias -toggleDuck "alias toggleDuck +toggleDuck; -duck" | + | alias +toggleDuck "alias toggleDuck -toggleDuck; +duck" |
− | alias +toggleDuck "alias toggleDuck -toggleDuck; +duck" | + | -toggleDuck |
− | -toggleDuck | + | bind <key> toggleDuck |
− | bind <key> toggleDuck | ||
− | |||
==Super Reportal== | ==Super Reportal== | ||
Line 123: | Line 118: | ||
Change alias that swaps between jumps on scroll wheel and portal shots. Use <code>attack</code> for blue portals, <code>attack2</code> for orange, and change the default up and down to your liking of standard scroll binds. | Change alias that swaps between jumps on scroll wheel and portal shots. Use <code>attack</code> for blue portals, <code>attack2</code> for orange, and change the default up and down to your liking of standard scroll binds. | ||
− | + | alias srOff "bind mwheelup +jump; bind mwheeldown +jump; say No SR; alias srChange srOn" | |
− | alias srOff "bind mwheelup +jump; bind mwheeldown +jump; say No SR; alias srChange srOn" | + | alias srOn "bind mwheelup +attack; bind mwheeldown +attack; say SR; alias srChange srOff" |
− | alias srOn "bind mwheelup +attack; bind mwheeldown +attack; say SR; alias srChange srOff" | + | srOff |
− | srOff | + | bind <key> srChange |
− | bind <key> srChange | ||
− | |||
==Use Swap== | ==Use Swap== | ||
Line 136: | Line 129: | ||
Action alias that, while held, changes your mouse wheel up to +use, and when released, changes it back. Switch these values as you see fit for your binds. | Action alias that, while held, changes your mouse wheel up to +use, and when released, changes it back. Switch these values as you see fit for your binds. | ||
− | + | alias +useSwap "bind mwheelup +use" | |
− | alias +useSwap "bind mwheelup +use" | + | alias -useSwap "bind mwheelup +jump" |
− | alias -useSwap "bind mwheelup +jump" | + | bind <key> +useSwap |
− | bind <key> +useSwap | ||
− | |||
==Walk Key== | ==Walk Key== | ||
Line 150: | Line 141: | ||
<pre style="color: red">Note: Challenge Mode has the cl speed commands cheat protected. They are allowed in Full game and AMC</pre> | <pre style="color: red">Note: Challenge Mode has the cl speed commands cheat protected. They are allowed in Full game and AMC</pre> | ||
− | + | alias +walk "cl_forwardspeed 84; cl_backspeed 84; cl_sidespeed 84" | |
− | alias +walk "cl_forwardspeed 84; cl_backspeed 84; cl_sidespeed 84" | + | alias -walk "cl_forwardspeed 175; cl_backspeed 175; cl_sidespeed 175" |
− | alias -walk "cl_forwardspeed 175; cl_backspeed 175; cl_sidespeed 175" | + | bind <key> +walk |
− | bind <key> +walk | ||
− | |||
==Viewmodel Commands== | ==Viewmodel Commands== | ||
Allow you to easily hide/unhide viewmodel | Allow you to easily hide/unhide viewmodel | ||
− | + | alias showvm "viewmodel_offset_x 0; viewmodel_offset_y 0; viewmodel_offset_z 0" | |
− | alias showvm "viewmodel_offset_x 0; viewmodel_offset_y 0; viewmodel_offset_z 0" | + | alias hidevm "viewmodel_offset_x 0; viewmodel_offset_y 0; viewmodel_offset_z 100" |
− | alias hidevm "viewmodel_offset_x 0; viewmodel_offset_y 0; viewmodel_offset_z 100" | ||
− | |||
==HUD Commands (Uses SAR)== | ==HUD Commands (Uses SAR)== | ||
Commands to add in a few [[SAR]] hud elements. <code>sarhud</code> uses the <code>showinputs</code> alias. The sar_hud values are set to replicate the values of cl_showpos. | Commands to add in a few [[SAR]] hud elements. <code>sarhud</code> uses the <code>showinputs</code> alias. The sar_hud values are set to replicate the values of cl_showpos. | ||
− | + | alias showinputs "sar_ihud 3; sar_ihud_setpos bottom left; sar_ihud_button_color 255 255 255 255" | |
− | alias showinputs "sar_ihud 3; sar_ihud_setpos bottom left; sar_ihud_button_color 255 255 255 255" | + | alias nosarhud "sar_hud_velocity 0; sar_hud_position 0; sar_hud_angles 0; sar_ihud 0; sar_sr_hud 0" |
− | alias nosarhud "sar_hud_velocity 0; sar_hud_position 0; sar_hud_angles 0; sar_ihud 0; sar_sr_hud 0" | + | alias sarhud "sar_hud_default_font_index 1; sar_hud_default_padding_y 5; sar_hud_default_spacing 5; sar_hud_velocity 1; sar_hud_position 2; sar_hud_angles 2; sar_sr_hud 1; sar_sr_hud_y 120; showinputs" |
− | alias sarhud "sar_hud_default_font_index 1; sar_hud_default_padding_y 5; sar_hud_default_spacing 5; sar_hud_velocity 1; sar_hud_position 2; sar_hud_angles 2; sar_sr_hud 1; sar_sr_hud_y 120; showinputs" | ||
− | |||
==Demo Viewing (Uses SAR)== | ==Demo Viewing (Uses SAR)== | ||
Line 178: | Line 163: | ||
<pre style="color: red">Note: Playing with sv_alternateticks 0 is banned. Only use it for demo watching</pre> | <pre style="color: red">Note: Playing with sv_alternateticks 0 is banned. Only use it for demo watching</pre> | ||
− | + | alias demo_viewer "sv_alternateticks 0; cl_enable_remote_splitscreen 1; sar_disable_challenge_stats_hud 1; gameinstructor_enable 0" | |
− | alias demo_viewer "sv_alternateticks 0; cl_enable_remote_splitscreen 1; sar_disable_challenge_stats_hud 1; gameinstructor_enable 0" | + | alias no_demo_viewer "sv_alternateticks 1; sar_disable_challenge_stats_hud 0" |
− | alias no_demo_viewer "sv_alternateticks 1; sar_disable_challenge_stats_hud 0" | ||
− | |||
[[Category:cvar]] | [[Category:cvar]] |
Latest revision as of 09:59, 29 June 2024
Overview
alias
is a console command that creates a new command. It takes two arguments, the first being the name of whatever command you are creating, and the second argument are the other commands that will make up your new command. They are incredibly powerful, but are forgotten by the game upon closing, so they are perfect for an autoexec.
For example, alias "defaultviewmodel" "viewmodel_offset_x 0; viewmodel_offset_y 0; viewmodel_offset_z 0"
creates a new command inside of Portal 2 called "defaultviewmodel"
, and typing this command will set all viewmodel offsets to 0.
Types of Examples
Standard Alias
You can add multiple functionalities to an alias, there is no limit, so long as the commands do not act as a script and follow the rules for both SRC and the challenge mode leaderboards.
Format
alias name "functionality1; functionality2; etc" bind key name
Change Commands
A change command is typically made of three aliases, and designed to be used as a one-key bind that toggles functionality by redefining the core alias.
Format
alias turnItOn "functionality; alias changeIt turnItOff" alias turnItOff "functionality; alias changeIt turnItOn" turnItOn // either on or off, depending on what you want as default bind <key> changeIt
Action Commands
An action command consists of two aliases of the same name, differentiated by the prefix +
or -
. Binding a key to the +
variant will keep the functionality active while the button is held down. Releasing the key enacts the -
variant.
Note: CM rules forbid binding of multiple actions to one key, including using aliases. Read more below.
Format
alias +action "functionality when pressed" alias -action "functionality when released" bind key +action
Common Examples
Video with common examples and explanations
Examples included in this video on execs:
- Challenge Mode Rules
- Speedrun.com Rules (Click on "View Rules")
- NeKz cvars Portal 2 List
- SAR cvars
- Quickstart Autoexec
- cfg suite (includes below aliases in autoexec.cfg)
Portal Funneling (Uses SAR)
Changing the value of portal funneling is banned in all categories other than CM.
- 1st Press: Portal Funneling off, value written to SAR HUD text element
- 2nd Press: Portal Funneling on, value written to SAR HUD text element
Change alias that swaps the values of Portal Funneling. SAR 1.12.3+ required.
sar_alias funnelingOff "sar_alias funnelingChange funnelingOn; sv_player_funnel_into_portals 0; sar_hud_set_text 0 Portal Funneling: #FF5555OFF" sar_alias funnelingOn "sar_alias funnelingChange funnelingOff; sv_player_funnel_into_portals 1; sar_hud_set_text 0 Portal Funneling: #55FF55ON" funnelingOn // on by default, replace with funnelingOff to be off by default bind <key> funnelingChange
Low Sensitivity (Uses SAR)
- 1st Press: Sensitivity is lowered for seamshots
- 2nd Press: Sensitivity is reset for regular gameplay
Toggle bind that lowers sensitivity for seamshots. SAR 1.12.3+ required.
sar_function resetSens "sensitivity $normalSens" sar_function captureSens "svar_from_cvar normalSens sensitivity" sar_alias lowSensOff "sar_alias lowSensToggle lowSensOn; resetSens" sar_alias lowSensOn "sar_alias lowSensToggle lowSensOff; captureSens; sensitivity 0.01" captureSens; lowSensOff bind <key> lowSensToggle
Ambient Light/Fullbright
- 1st Press: Ambient light for red, green and blue set to .07
- 2nd Press: Ambient light for red, green and blue set to 0
Change alias that switches between different values of ambient light. Used to combat video compression on Turret Factory and sometimes Catapult Block.
alias ambientOff "alias ambientChange ambientOn; mat_ambient_light_r 0; mat_ambient_light_g 0; mat_ambient_light_b 0" alias ambientOn "alias ambientChange ambientOff; mat_ambient_light_r .07; mat_ambient_light_g .07; mat_ambient_light_b .07" ambientOff // Off by default, replace with ambientOn to be on by default bind <key> ambientChange
Dialogue
- 1st Press: Lowers the dialogue for all main voice overs
- 2nd Press: Brings the dialogue volume back to default levels
Change alias that toggles between making dialogue silent and bringing values back up to default
alias dialogueFull "alias dialogueChange dialogueMute; snd_setmixer potatosVO vol .4; snd_setmixer gladosVO vol .7; snd_setmixer announcerVO vol .7; snd_setmixer wheatleyVO vol .7; snd_setmixer caveVO vol .88; snd_setmixer coreVO vol .75" alias dialogueMute "alias dialogueChange dialogueFull; snd_setmixer potatosVO vol .01; snd_setmixer gladosVO vol .01; snd_setmixer announcerVO vol .01; snd_setmixer wheatleyVO vol .01; snd_setmixer caveVO vol .01; snd_setmixer coreVO vol .01" dialogueFull // replace with dialogueMute to be muted by default bind <key> dialogueChange
Toggle duck
- 1st Press: Player stays in a crouched position
- 2nd Press: Player is taken out of crouched position
Change alias that toggles the duck functionality (crouching). Useful for Coop Any% runs.
alias -toggleDuck "alias toggleDuck +toggleDuck; -duck" alias +toggleDuck "alias toggleDuck -toggleDuck; +duck" -toggleDuck bind <key> toggleDuck
Super Reportal
- 1st Press: Both mouse wheels are switched to firing blue portals
- 2nd Press: Both mouse wheels are switched to jumping.
Change alias that swaps between jumps on scroll wheel and portal shots. Use attack
for blue portals, attack2
for orange, and change the default up and down to your liking of standard scroll binds.
alias srOff "bind mwheelup +jump; bind mwheeldown +jump; say No SR; alias srChange srOn" alias srOn "bind mwheelup +attack; bind mwheeldown +attack; say SR; alias srChange srOff" srOff bind <key> srChange
Use Swap
- Held: Mouse wheel up is
+use
- Released: Mouse wheel up is
+jump
Action alias that, while held, changes your mouse wheel up to +use, and when released, changes it back. Switch these values as you see fit for your binds.
alias +useSwap "bind mwheelup +use" alias -useSwap "bind mwheelup +jump" bind <key> +useSwap
Walk Key
- Held: Player movement speed is reduced to 84
- Released: Player movement speed is reset to 175
Action alias that, while held, gives the player slower movement
Note: Challenge Mode has the cl speed commands cheat protected. They are allowed in Full game and AMC
alias +walk "cl_forwardspeed 84; cl_backspeed 84; cl_sidespeed 84" alias -walk "cl_forwardspeed 175; cl_backspeed 175; cl_sidespeed 175" bind <key> +walk
Viewmodel Commands
Allow you to easily hide/unhide viewmodel
alias showvm "viewmodel_offset_x 0; viewmodel_offset_y 0; viewmodel_offset_z 0" alias hidevm "viewmodel_offset_x 0; viewmodel_offset_y 0; viewmodel_offset_z 100"
HUD Commands (Uses SAR)
Commands to add in a few SAR hud elements. sarhud
uses the showinputs
alias. The sar_hud values are set to replicate the values of cl_showpos.
alias showinputs "sar_ihud 3; sar_ihud_setpos bottom left; sar_ihud_button_color 255 255 255 255" alias nosarhud "sar_hud_velocity 0; sar_hud_position 0; sar_hud_angles 0; sar_ihud 0; sar_sr_hud 0" alias sarhud "sar_hud_default_font_index 1; sar_hud_default_padding_y 5; sar_hud_default_spacing 5; sar_hud_velocity 1; sar_hud_position 2; sar_hud_angles 2; sar_sr_hud 1; sar_sr_hud_y 120; showinputs"
Demo Viewing (Uses SAR)
Command to make demo viewing more seamless, and to undo those changes so that playing can resume after watching.
Note: Playing with sv_alternateticks 0 is banned. Only use it for demo watching
alias demo_viewer "sv_alternateticks 0; cl_enable_remote_splitscreen 1; sar_disable_challenge_stats_hud 1; gameinstructor_enable 0" alias no_demo_viewer "sv_alternateticks 1; sar_disable_challenge_stats_hud 0"