YSM Molang reference: Math functions
Every Molang function and variable you can use in Yes Steve Model animations and controllers, with what it returns and the YSM version that added it. New to Molang? Start with Molang in YSM.
- All 280
- Math functions 33
- Query (q.) 60
- YSM player & entity 105
- YSM projectiles 9
- Controller (ctrl.) 25
- Script controller 5
- TaCZ guns 9
- Immersive Melodies 5
- Touhou Little Maid 16
- Curios accessories 4
- Other mods 9
| Molang | What it does | Since |
|---|---|---|
| math.pi | Pi (π), constantFixed at 3.14159265358979 | 1.1.5 |
| math.e | Euler's number (e), constantFixed at 2.71828182845904 | 1.1.5 |
| math.floor(value) | Round value down to the nearest integer | 1.1.5 |
| math.round(value) | Round value to the nearest integer | 1.1.5 |
| math.ceil(value) | Round value up to the nearest integer | 1.1.5 |
| math.trunc(value) | Truncate value to an integer (rounds towards zero, which rounds up for negative numbers) | 1.1.5 |
| math.clamp(value, min, max) | Clamp value between min and max | 1.1.5 |
| math.max(x, y) | Return the maximum of x and y | 1.1.5 |
| math.min(x, y) | Return the minimum of x and y | 1.1.5 |
| math.abs(value) | Absolute value of value | 1.1.5 |
| math.exp(value) | Exponential function of value with base e ($e^{value}$) | 1.1.5 |
| math.ln(value) | Natural logarithm of value (base e) | 1.1.5 |
| math.sqrt(value) | Square root of value | 1.1.5 |
| math.mod(value, denominator) | Remainder of value divided by denominator | 1.1.5 |
| math.pow(base, exponent) | Return base raised to the power of exponent | 1.1.5 |
| math.sin(value) | Sine of valueInput is in degrees | 1.1.5 |
| math.cos(value) | Cosine of valueInput is in degrees | 1.1.5 |
| math.acos(value) | Arccosine of valueInput value range is [-1, 1], returns radians | 1.1.5 |
| math.asin(value) | Arcsine of valueInput value range is [-1, 1], returns radians | 1.1.5 |
| math.atan(value) | Arctangent of valueInput value range is [-∞, +∞], returns radians | 1.1.5 |
| math.atan2(y, x) | Angle (in radians) between the positive x-axis and the ray from (0,0) to (x,y) | 1.1.5 |
| math.lerp(start, end, 0_to_1) | Linearly interpolate between start and end via 0_to_1Equivalent to: $start + (end - start) \times 0\_to\_1$ | 1.1.5 |
| math.lerprotatee(start, end, 0_to_1) | Interpolate angle between start and end via 0_to_1Wraps around to 0 when exceeding 360 degrees | 1.1.5 |
| math.random(low, high) | Return a random number between low and high | 1.1.5 |
| math.random_integer(low, high) | Return a random **integer** between low and high | 1.1.5 |
| math.die_roll(num, low, high) | Return the sum of num random numbers, each ranging from low to highGenerated numbers are **not** integers like normal dice. Use math.die_roll_integer for that. | 1.1.5 |
| math.die_roll_integer(num, low, high) | Return the sum of num random integers, each ranging from low to highGenerated numbers are integers, like normal dice | 1.1.5 |
| math.hermite_blend(value) | Smooth curve interpolation using a Hermite function: $3 \times value^{2} - 2 \times value^{3}$While any valid float is a valid input, this works best in the [0, 1] range | 1.1.5 |
| math.min_angle(value) | Wrap an angle into the equivalent [-180, 180) rangeRemoves extra full rotations from the input angle to keep it within [-180, 180] | 1.2.0 |
| math.randomi(value) | Same as math.random_integerNon-standard naming, for original GeckoLib compatibility only | 1.1.5 |
| math.roll(value) | Same as math.die_rollNon-standard naming, for original GeckoLib compatibility only | 1.1.5 |
| math.rolli(value) | Same as math.die_roll_integerNon-standard naming, for original GeckoLib compatibility only | 1.1.5 |
| math.hermite(value) | Same as math.hermite_blendNon-standard naming, for original GeckoLib compatibility only | 1.1.5 |