roll.result: Difference between revisions
Jump to navigation
Jump to search
m (Conversion script moved page Roll.result to roll.result: Converting page titles to lowercase) |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
===Examples=== | ===Examples=== | ||
====Example Mimicking the Default Display==== | ====Example Mimicking the Default Display==== | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:AtkBonus=6] | [h:AtkBonus=6] | ||
[h:AbilBonus=4] | [h:AbilBonus=4] | ||
Attack Result: [t(roll.result): 1d20+AtkBonus+AbilBonus] | Attack Result: [t(roll.result): 1d20+AtkBonus+AbilBonus] | ||
</ | </syntaxhighlight> | ||
[[Image:Tooltip-rollresult-example.jpg|frame|right]] | [[Image:Tooltip-rollresult-example.jpg|frame|right]] | ||
Line 17: | Line 17: | ||
To illustrate how the order of evaluation can be useful, consider the following short example: | To illustrate how the order of evaluation can be useful, consider the following short example: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[t( if(roll.result > 10, "Hit", "Miss") ): d20] | [t( if(roll.result > 10, "Hit", "Miss") ): d20] | ||
</ | </syntaxhighlight> | ||
This example will display {{code|Hit}} or {{code|Miss}} depending on the result of the d20 roll, and the tooltip when hovering over either word will be the actual numeric result of the d20 roll. | This example will display {{code|Hit}} or {{code|Miss}} depending on the result of the d20 roll, and the tooltip when hovering over either word will be the actual numeric result of the d20 roll. | ||
Line 26: | Line 26: | ||
[[Category:Special Variable]] | [[Category:Special Variable]] | ||
[[Category:Macro Function]] |
Latest revision as of 23:59, 4 July 2023
The special variable roll.result
is used within the parameter of the [tooltip:] roll option.
Examples
Example Mimicking the Default Display
[h:AtkBonus=6]
[h:AbilBonus=4]
Attack Result: [t(roll.result): 1d20+AtkBonus+AbilBonus]
Evaluates 1d20+AtkBonus+AbilBonus
, assigns that value to roll.result
, and then displays the final result with a tooltip containing the value of roll.result
.
The parameter for the [tooltip:] roll option is evaluated after the roll itself is evaluated, so that roll.result
is available for display.
Example of a Custom Tooltip Based on the roll.result
To illustrate how the order of evaluation can be useful, consider the following short example:
[t( if(roll.result > 10, "Hit", "Miss") ): d20]
This example will display Hit
or Miss
depending on the result of the d20 roll, and the tooltip when hovering over either word will be the actual numeric result of the d20 roll.