Difference between revisions of "Alias"
m (Change link to new site) |
m (name change) |
||
Line 31: | Line 31: | ||
<pre style="color:red">Note: iVerb rules forbid binding of multiple actions to one key, including using aliases. Read more below.</pre> | <pre style="color:red">Note: iVerb rules forbid binding of multiple actions to one key, including using aliases. Read more below.</pre> | ||
− | [https://rules.portal2.sr/ | + | [https://rules.portal2.sr/ Rules doc] |
====Format==== | ====Format==== |
Revision as of 01:14, 29 January 2023
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 iVerb.
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: iVerb 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:
- iVerb Rules doc
- 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"