From f7813d80083ae818fa0bfb5b360214a8f2c0e216 Mon Sep 17 00:00:00 2001 From: Richard Wilkes Date: Wed, 27 Dec 2023 16:29:21 -0800 Subject: [PATCH] Add documentation for the new expression functions coming in v5.19. add_dice(dice_spec1, dice_spec2) dice_count(dice_spec) dice_modifier(dice_spec) dice_multiplier(dice_spec) dice_sides(dice_spec) subtract_dice(dice_spec1, dice_spec2) --- Library/Markdown/Help/Expression Functions.md | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/Library/Markdown/Help/Expression Functions.md b/Library/Markdown/Help/Expression Functions.md index f56e69a16..b2727ee4e 100644 --- a/Library/Markdown/Help/Expression Functions.md +++ b/Library/Markdown/Help/Expression Functions.md @@ -1,37 +1,43 @@ ### Expression Functions -| Function | Description | -| ------------------------------------------- | ------------------------------------------- | -| abs(number) | Returns the absolute value of the `number`. | -| advantage_level(name) | ***Deprecated.*** Looks for a trait with the `name` and returns its level or -1 if it can't be found. **Not available prior to v4.31**. Use `trait_level(name)` for **v5+.** | -| cbrt(number) | Returns the cube root of the `number`. | -| ceil(number) | Returns the smallest (closest to negative infinity) value that is greater than or equal to the `number` and is equal to a mathematical integer. | -| dice(sides) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(4)` would return `1d4`. | -| dice(count, sides) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(2,4)` would return `2d4`. | -| dice(count, sides, modifier) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(2,4,-1)` would return `2d4-1`. | -| dice(count, sides, modifier, multiplier) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(2,4,-1,2)` would return `2d4-1x2`. | -| enc(forSkills) | Returns the current encumbrance modifier (a value from 0 to 4). If `forSkills` is true, the modifier is adjusted to account for equipment that has been marked as not having its weight counting against skills. **Not available prior to v5.3.** | -| enc(forSkills, returnFactor) | Returns the current encumbrance modifier (a value from 0 to 4) or the move multiplication factor if `returnFactor` is true. If `forSkills` is true, the modifier is adjusted to account for equipment that has been marked as not having its weight counting against skills. **Not available prior to v5.4.** | -| exp(number) | Returns Euler's number e raised to the power of the `number`. | -| floor(number) | Returns the largest (closest to positive infinity) value that is less than or equal to the `number` and is equal to a mathematical integer. | -| if(test, true_result, false_result) | Returns `false_result` if `test` resolves to 0 or an empty string, otherwise returns `true_result`. | -| log(number) | Returns the natural logarithm (base e) of the `number`. | -| log1p(number) | Returns the natural logarithm of the sum of the `number` and 1. | -| log10(number) | Returns the base 10 logarithm of the `number`. | -| max(num1, num2) | Returns the greater of `num1` or `num2`. | -| min(num1, num2) | Returns the lesser of `num1` or `num2`. | -| pow(num1, num2) | Returns the value of `num1` raised to the power of `num2`. | -| roll(dice_spec) | Returns the result of rolling dice (dice_spec uses standard dice notation or the result of a call to the `dice` function). | -| round(number) | Returns the closest integer value to the `number`, with ties rounding to positive infinity. | -| signed(number) | Returns the `number` with a leading '+' if it is positive. | -| skill_level(name) | Looks for a skill with `name` and no specialization and returns its level or 0 if it can't be found. **Not available prior to v5.4.** | -| skill_level(name, specialization) | Looks for a skill with `name` and `specialization` and returns its level or 0 if it can't be found. **Not available prior to v5.4.** | -| skill_level(name, specialization, relative) | Looks for a skill with `name` and `specialization` and returns its level or 0 if it can't be found. If `relative` is true, the relative level is returned instead. **Not available prior to v5.4.** | -| sqrt(number) | Returns the positive square root of `number`. | +| Function | Description | +|---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| abs(number) | Returns the absolute value of the `number`. | +| add_dice(dice_spec1, dice_spec2) | Adds two dice specifications together and returns a string suitable for passing to the `roll(dice_spec)` function. `add_dice(1d+1, 1d-2)` would return `2d-1`. | +| advantage_level(name) | ***Deprecated.*** Looks for a trait with the `name` and returns its level or -1 if it can't be found. **Not available prior to v4.31**. Use `trait_level(name)` for **v5+.** | +| cbrt(number) | Returns the cube root of the `number`. | +| ceil(number) | Returns the smallest (closest to negative infinity) value that is greater than or equal to the `number` and is equal to a mathematical integer. | +| dice(sides) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(4)` would return `1d4`. | +| dice(count, sides) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(2,4)` would return `2d4`. | +| dice(count, sides, modifier) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(2,4,-1)` would return `2d4-1`. | +| dice(count, sides, modifier, multiplier) | Returns a string suitable for passing to the `roll(dice_spec)` function. `dice(2,4,-1,2)` would return `2d4-1x2`. | +| dice_count(dice_spec) | Returns the number of dice in the `dice_spec`. `dice_count(2d+3)` would return `2`. | +| dice_modifier(dice_spec) | Returns the modifier in the `dice_spec`. `dice_modifier(2d+3)` would return `3`. | +| dice_multiplier(dice_spec) | Returns the multiplier in the `dice_spec`. `dice_multiplier(2d+3)` would return `1`, while `dice_multiplier(2d+3x4)` would return `4`. | +| dice_sides(dice_spec) | Returns the number of sides on each die in the `dice_spec`. `dice_sides(2d+3)` would return `6`. | +| enc(forSkills) | Returns the current encumbrance modifier (a value from 0 to 4). If `forSkills` is true, the modifier is adjusted to account for equipment that has been marked as not having its weight counting against skills. **Not available prior to v5.3.** | +| enc(forSkills, returnFactor) | Returns the current encumbrance modifier (a value from 0 to 4) or the move multiplication factor if `returnFactor` is true. If `forSkills` is true, the modifier is adjusted to account for equipment that has been marked as not having its weight counting against skills. **Not available prior to v5.4.** | +| exp(number) | Returns Euler's number e raised to the power of the `number`. | +| floor(number) | Returns the largest (closest to positive infinity) value that is less than or equal to the `number` and is equal to a mathematical integer. | +| if(test, true_result, false_result) | Returns `false_result` if `test` resolves to 0 or an empty string, otherwise returns `true_result`. | +| log(number) | Returns the natural logarithm (base e) of the `number`. | +| log1p(number) | Returns the natural logarithm of the sum of the `number` and 1. | +| log10(number) | Returns the base 10 logarithm of the `number`. | +| max(num1, num2) | Returns the greater of `num1` or `num2`. | +| min(num1, num2) | Returns the lesser of `num1` or `num2`. | +| pow(num1, num2) | Returns the value of `num1` raised to the power of `num2`. | +| roll(dice_spec) | Returns the result of rolling dice (dice_spec uses standard dice notation or the result of a call to the `dice` function). | +| round(number) | Returns the closest integer value to the `number`, with ties rounding to positive infinity. | +| signed(number) | Returns the `number` with a leading '+' if it is positive. | +| skill_level(name) | Looks for a skill with `name` and no specialization and returns its level or 0 if it can't be found. **Not available prior to v5.4.** | +| skill_level(name, specialization) | Looks for a skill with `name` and `specialization` and returns its level or 0 if it can't be found. **Not available prior to v5.4.** | +| skill_level(name, specialization, relative) | Looks for a skill with `name` and `specialization` and returns its level or 0 if it can't be found. If `relative` is true, the relative level is returned instead. **Not available prior to v5.4.** | +| sqrt(number) | Returns the positive square root of `number`. | | ssrt(length, units, flag) | Returns a value from the Size and Speed/Range Table on [B550](B550). `length` should be a number. `units` should be one of `in`, `ft`, `yd`, `mi`, `cm`, `km`, or `m`. `flag` should be true to have it return the size modifier or false to return the speed/range modifier. **Not available prior to v4.32.** | -| ssrt_to_yards(size_modifier) | Returns the number of yards for the given `size_modifier` from the Size and Speed/Range Table on [B550](B550). **Not available prior to v4.32.** | -| trait_level(name) | Looks for a trait with the `name` and returns its level or -1 if it can't be found. **Not available prior to v5.** | +| ssrt_to_yards(size_modifier) | Returns the number of yards for the given `size_modifier` from the Size and Speed/Range Table on [B550](B550). **Not available prior to v4.32.** | +| subtract_dice(dice_spec1, dice_spec2) | Subtracts the first dice specification from the second and returns a string suitable for passing to the `roll(dice_spec)` function. `subtract_dice(3d+1, 2d+2)` would return `1d-1`. | +| trait_level(name) | Looks for a trait with the `name` and returns its level or -1 if it can't be found. **Not available prior to v5.** | See also: [Expression Operators](./Expression%20Operators.md) -***Last updated for v5.7.0*** \ No newline at end of file +***Last updated for v5.19.0***