Difference between revisions of "MakeDice"
From UODemo Wiki
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | void '''makeDice'''(string &''ResultString'', string '' | + | void '''makeDice'''(string &''ResultString'', string ''InitialString'', integer ''Rolls'', integer ''Sides'', string ''MinimumPrefix'', integer ''Minimum''); |
The makeDice function will convert the dice parameters (''Rolls'', ''Sides'' and ''Minimum'') to a string. | The makeDice function will convert the dice parameters (''Rolls'', ''Sides'' and ''Minimum'') to a string. | ||
− | Notes:<br>'' | + | Notes:<br>''Sides'' is only appended if it's non-zero and when appended it's always prefixed by a "d" character.<br>''Minimum'' is only appended if ''MinimumPrefix'' is not an empty string and if ''Minimum'' itself is non-zero. |
Line 10: | Line 10: | ||
<code><pre> | <code><pre> | ||
string test = "Empty String"; | string test = "Empty String"; | ||
− | makeDice(test, " | + | makeDice(test, "Test Dice A: ", 5, 8, "!", 0 - 5); |
-> | -> | ||
− | " | + | "Test Dice A: 5d8!-5" |
</pre></code> | </pre></code> | ||
<code><pre> | <code><pre> | ||
string test; | string test; | ||
− | makeDice(test, " | + | makeDice(test, "Test Dice B: ", 5, 0, "", 9999); |
-> | -> | ||
− | " | + | "Test Dice B: 5" |
</pre></code> | </pre></code> | ||
<code><pre> | <code><pre> | ||
string test = ""; | string test = ""; | ||
− | makeDice(test, " | + | makeDice(test, "", 5, 0, "+", 5); |
-> | -> | ||
− | " | + | "5+5" |
</pre></code> | </pre></code> | ||
Return to the [[Command List]]. | Return to the [[Command List]]. |
Latest revision as of 22:19, 26 January 2010
void makeDice(string &ResultString, string InitialString, integer Rolls, integer Sides, string MinimumPrefix, integer Minimum);
The makeDice function will convert the dice parameters (Rolls, Sides and Minimum) to a string.
Notes:
Sides is only appended if it's non-zero and when appended it's always prefixed by a "d" character.
Minimum is only appended if MinimumPrefix is not an empty string and if Minimum itself is non-zero.
Examples:
string test = "Empty String";
makeDice(test, "Test Dice A: ", 5, 8, "!", 0 - 5);
->
"Test Dice A: 5d8!-5"
string test;
makeDice(test, "Test Dice B: ", 5, 0, "", 9999);
->
"Test Dice B: 5"
string test = "";
makeDice(test, "", 5, 0, "+", 5);
->
"5+5"
Return to the Command List.