Welcome to PenUltima Online. Click to login or register.

File: Util.em

Description: Utility functions
Last Modified: 08/31/2015

Modules:

RandomDiceRoll(dice_string)
Parameters:
Name Type
dice_string String
Explanation
Returns a random number according to the passed die roll string. This is standard NdS+X format. N=number of dies to roll, S=number of sides per die, X=integer to add(or subtract) after roll.
Here's some acceptable examples:
4
d4
d6+6
d6-2
2d12
2d8+12
2d8-4
Return values
Valkyrie's pedantic wording: "returns an integer greater or equal to N+X and not more than N*S+X"
RandomFloat(below_this_float)
Parameters:
Name Type
below_this_float Real
Explanation
Returns a random real below the passed parameter and greater or equal to zero.
Return values
Real R such that 0 less or equal to R less than below_this_number
Errors
"RandomFloat() expects a Real parameter"
RandomInt(below_this_number)
Parameters:
Name Type
below_this_number Integer
Explanation
Returns a random integer below the passed parameter and greater or equal to zero.
Return values
Integer R such that 0 less or equal to R less than below_this_number
Errors
"RandomInt() expects a positive integer"
RandomIntMinMax(minValue, maxValue)
Parameters:
Name Type
minValue Integer
maxValue Integer
Explanation
Returns a random integer between the Min and Max integers passed. Accepts negative Integers and if parameters in wrong order swaps them.
Return values
Integer Randomly between Min and Max parameters
Errors
"RandomIntMinMax() expects an integer"
StrFormatTime( format_string, time_stamp:=0 )
Parameters:
Name Type
format_string String
time_stamp Integer
Explanation
Takes in the StrFTime() specifiers for the format string.
If time_stamp is 0, it will use POLCore().systime.
For format_string information, please go to http://www.cppreference.com/stddate/strftime.html
Return values
String
Errors
"No time string passed."
"Format string exceeded 100 characters."