From EventScripts Community Encyclopedia
|
Overview
Syntax:
es_mathparse
<output-variable> "<math-expression>"
Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.
Variation of this command that doesn't expand variables: es_xmathparse
Description
Stores the result of a mathmatical expression in the output variable.
Parameters
- output-variable - Stores the output of the mathmatical expression
- math-expression - A mathmatical expression of numbers, server variables, and common mathmatical functions.
Examples
es_mathparse myvar "4*sin(30)+log(sv_gravity)"
myvar
"myvar" "-1.049037" ( def. "" )
- Custom server variable.
Notes
- Server variables can be referenced with their raw names. They do not need "server_var" to resolve. (e.g. "3 + mp_flashlight")
- This command makes use of the muParser library for math text parsing. Refer to its documentation for special cases, etc.
- Supports some constants like _pi and _e.
- Also supports the unary ! operator (not) to return the boolean opposite of the value.
- This command was first introduced in EventScripts v1.3.
See also
|
|