fudge: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (revert)
m (Replaced source tages with syntaxhighlight)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=fudge
    |name=fudge
|description=
    |description=
Generates random numbers to emulate dice rolls; returns the total of a special Fudge dice roll. When these dice are rolled, the result is {{code|-1}}, {{code|0}}, or {{code|1}}, this function then sums up all of the dice rolled and returns that sum.
    Generates random numbers to emulate dice rolls; returns the total of a special Fudge dice roll. When these dice are rolled, the result is {{code|-1}}, {{code|0}}, or {{code|1}}, this function then sums up all of the dice rolled and returns that sum.
 
   
|usage=
    |usage=
<source lang="mtmacro" line>
    <syntaxhighlight lang="mtmacro" line>
fudge(times)
    fudge(times)
</source>
    </syntaxhighlight>
<source lang="mtmacro" line>
    <syntaxhighlight lang="mtmacro" line>
f(times)
    f(times)
</source>
    </syntaxhighlight>
'''Parameters'''
    '''Parameters'''
{{param|times|The number of times to roll the dice.}}
    {{param|times|The number of times to roll the dice.}}
 
   
|examples=
    |examples=
Roll ten special Fudge dice.
    Roll ten special Fudge dice.
<source lang="mtmacro" line>
    <syntaxhighlight lang="mtmacro" line>
[t: fudge(10)]
    [t: fudge(10)]
</source>
    </syntaxhighlight>
Returns a number that is between {{code|-10}} and {{code|10}}.
    Returns a number that is between {{code|-10}} and {{code|10}}.
 
   
Roll five special Fudge dice, using variables.
    Roll five special Fudge dice, using variables.
<source lang="mtmacro" line>
    <syntaxhighlight lang="mtmacro" line>
[h: DiceTimes = 5]
    [h: DiceTimes = 5]
[t: fudge(DiceTimes)]
    [t: fudge(DiceTimes)]
</source>
    </syntaxhighlight>
Returns a number than is between {{code|-5}} and {{code|5}}.
    Returns a number than is between {{code|-5}} and {{code|5}}.
 
   
|also=
    |also=
For another method of rolling dice, see [[Dice Expressions]].
    For another method of rolling dice, see [[Dice Expressions]].
 
   
}}
    }}
[[Category:Dice Function]]
    [[Category:Dice Function]]

Revision as of 18:03, 14 July 2022

fudge() Function

Generates random numbers to emulate dice rolls; returns the total of a special Fudge dice roll. When these dice are rolled, the result is -1, 0, or 1, this function then sums up all of the dice rolled and returns that sum.

Usage

    fudge(times)
    f(times)
   Parameters
   
  • times - The number of times to roll the dice.

Examples

Roll ten special Fudge dice.
    [t: fudge(10)]
   Returns a number that is between -10 and 10.
   
   Roll five special Fudge dice, using variables.
    [h: DiceTimes = 5]
    [t: fudge(DiceTimes)]
Returns a number than is between -5 and 5.

See Also

For another method of rolling dice, see Dice Expressions.