This article's documentation is for anything that uses the Source engine. Click here for more information.

Multvar: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (Replacing {{console command}}. This operation was performed by a bot.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{ent|multvar}} multiplies the current value of the cvar provided by a factor while keeping it between two limits.
{{this is a|console command|name=multvar}}
{{command|multvar}} multiplies the current value of the cvar provided by a factor while keeping it between two limits.


==Syntax==
==Syntax==
  multvar CVAR MINVALUE MAXVALUE FACTOR
{{pre|multvar CVAR MINVALUE MAXVALUE FACTOR}}


*CVAR: a console variable we want to change.
*<tt>CVAR</tt>: a console variable we want to change.
*MINVALUE: a minimum bound for our variable.
*<tt>MINVALUE</tt>: a minimum bound for our variable.
*MAXVALUE: a maximum bound for our variable.
*<tt>MAXVALUE</tt>: a maximum bound for our variable.
*FACTOR: the number to multiply the current value of the cvar by.
*<tt>FACTOR</tt>: the number to multiply the current value of the cvar by.


If the product is out of the range specific by <code>MINVALUE</code> and <code>MAXVALUE</code>, the product will be clamped.
If the product is out of the range specific by <code>MINVALUE</code> and <code>MAXVALUE</code>, the product will be clamped.
Line 13: Line 14:
==Examples==
==Examples==
Set the voice chat volume to 50% of its current value:
Set the voice chat volume to 50% of its current value:
  multvar voice_scale 0 1 0.5
{{pre|multvar voice_scale 0 1 0.5}}


If <code>voice_scale</code> was 1, it is now at 0.5.
If <code>voice_scale</code> was 1, it is now at 0.5.
To set it back to its previous value use a factor of 2:
To set it back to its previous value use a factor of 2:
  multvar voice_scale 0 1 2.0
{{pre|multvar voice_scale 0 1 2.0}}
<br>
<br>
Flip the sign of <code>viewmodel_fov</code> from positive to negative
Flip the sign of <code>viewmodel_fov</code> from positive to negative
  multvar viewmodel_fov -180 180 -1
{{pre|multvar viewmodel_fov -180 180 -1}}


==See also==
==See also==
* {{ent|incrementvar}} add instead of multiply
* {{ent|incrementvar}} add instead of multiply
[[Category:Console Commands]]

Latest revision as of 18:00, 7 January 2024

multvar is a console command available in all Source Source games. multvar multiplies the current value of the cvar provided by a factor while keeping it between two limits.

Syntax

multvar CVAR MINVALUE MAXVALUE FACTOR
  • CVAR: a console variable we want to change.
  • MINVALUE: a minimum bound for our variable.
  • MAXVALUE: a maximum bound for our variable.
  • FACTOR: the number to multiply the current value of the cvar by.

If the product is out of the range specific by MINVALUE and MAXVALUE, the product will be clamped.

Examples

Set the voice chat volume to 50% of its current value:

multvar voice_scale 0 1 0.5

If voice_scale was 1, it is now at 0.5. To set it back to its previous value use a factor of 2:

multvar voice_scale 0 1 2.0


Flip the sign of viewmodel_fov from positive to negative

multvar viewmodel_fov -180 180 -1

See also