Difference between revisions of "User:Paxed/Template:dicemax"

From NetHackWiki
Jump to navigation Jump to search
m (testing)
 
m (typofix)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
<onlyinclude><includeonly>{{#expr:{{{1}}}*{{{2}}}+{{{3|0}}}}}</includeonly></onlyinclude>
+
<onlyinclude><includeonly>{{#if: {{#pos:{{{1}}}|d}} |{{#expr:{{#if:{{#explode:{{{1}}}|d|0}}|{{#explode:{{{1}}}|d|0}}|1}}*{{#explode:{{{1}}}|d|1}}}} |{{{1}}} }}</includeonly></onlyinclude>
  
This template returns the maximum value a die roll in the standard [[d notation|d-notation]] can give. This cannot handle more than one d-notation, so no <tt>1d6+1d4</tt>.
+
This template returns the maximum value a die roll in the standard [[d notation|d-notation]] can give. This cannot handle more than one d-notation, so no <tt>1d6+1d4</tt>. See also [[User:Paxed/Template:dicemin]].
  
Usage: <tt><nowiki>{{dicemax|A|B|C}}</nowiki></tt>
+
Usage: <tt><nowiki>{{dicemax|AdB+C}}</nowiki></tt>
  
 
Where:
 
Where:
*A is the number of dice to be rolled.
+
*A is the number of dice to be rolled. This is optional and defaults to 1 if missing.
 
*B is the number of sides the dices have.
 
*B is the number of sides the dices have.
*C is an (optional) modifier added after the diceroll.
+
*+C is an optional modifier, such as <tt>+5</tt> or <tt>-2</tt>. Should be a simple integer, either plus or minus.
  
 
Output:
 
Output:
*<tt><nowiki>{{dicemax|1|6}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|1|6}}</tt>
+
*<tt><nowiki>{{dicemax|4}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|4}}</tt>
*<tt><nowiki>{{dicemax|2|10|5}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|2|10|5}}</tt>
+
*<tt><nowiki>{{dicemax|-4}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|-4}}</tt>
*<tt><nowiki>{{dicemax|3|8|-2}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|3|8|-2}}</tt>
+
*<tt><nowiki>{{dicemax|4d}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|4d}}</tt>
 +
*<tt><nowiki>{{dicemax|d4}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|d4}}</tt>
 +
*<tt><nowiki>{{dicemax|1d6}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|1d6}}</tt>
 +
*<tt><nowiki>{{dicemax|2d10}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|2d10}}</tt>
 +
*<tt><nowiki>{{dicemax|3d8}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|3d8}}</tt>
 +
*<tt><nowiki>{{dicemax|1d8+5}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|1d8+5}}</tt>
 +
*<tt><nowiki>{{dicemax|2d4-1}}</nowiki></tt> shows <tt>{{:User:Paxed/Template:dicemax|2d4-1}}</tt>

Latest revision as of 16:00, 27 March 2008


This template returns the maximum value a die roll in the standard d-notation can give. This cannot handle more than one d-notation, so no 1d6+1d4. See also User:Paxed/Template:dicemin.

Usage: {{dicemax|AdB+C}}

Where:

  • A is the number of dice to be rolled. This is optional and defaults to 1 if missing.
  • B is the number of sides the dices have.
  • +C is an optional modifier, such as +5 or -2. Should be a simple integer, either plus or minus.

Output:

  • {{dicemax|4}} shows 4
  • {{dicemax|-4}} shows -4
  • {{dicemax|4d}} shows Expression error: Missing operand for *.
  • {{dicemax|d4}} shows 4
  • {{dicemax|1d6}} shows 6
  • {{dicemax|2d10}} shows 20
  • {{dicemax|3d8}} shows 24
  • {{dicemax|1d8+5}} shows 13
  • {{dicemax|2d4-1}} shows 7