Template:Plus if pos: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (Taylan moved page Template:Plus if positive to Template:Plus if pos without leaving a redirect) |
Revision as of 01:20, 7 June 2024
Adds a plus sign in front of a number if it's positive. Example:
{{plus if positive | 5 }}
Result:
This is useful when calculating some modifier. For example:
{{hidden code| {{#lvardef: dex | 14 }} {{#lvardef: dex_mod | {{plus if positive | {{#expr: floor({{#lvar:dex}} / 2) - 5 }} }} }} }} Your Dexterity Modifier is: {{#lvar:dex_mod}}
Result:
Your Dexterity Modifier is: Template:Plus if positive
(Note: Don't be confused by use of Template:Hidden code in the example; it's an unrelated trick for using variable definitions without causing empty paragraphs.)