Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Plus if pos

Template page

Adds a plus sign in front of a number if it's positive. Also accepts mathematical expressions. Example:

{{plus if pos | 2 + 3 }}

Result:

+5

This is useful when calculating some modifier. For example:

{{hidden code|

{{#lvardef: dex | 14 }}
{{#lvardef: dex_mod | {{plus if pos | floor({{#lvar:dex}} / 2) - 5 }} }}

}}

Your Dexterity Modifier is: {{#lvar:dex_mod}}

Result:

Your Dexterity Modifier is: +2

(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.)