Basic functions in DD2. These functions can be called directly from core code. Example:
$a=sum(1,2);
.
avg (a1..aN) - Returns averange value of a1..aN.
charAt (str, pos) - Returns character on position pos in string str.
exec (what) - Exec code 'what'.
indexOf (str, sub) - Returns index of first postion of sub in str.
lc (str) - Converts strings to lower case.
length (str) - Returns length of string s.
max (a1..aN) - Returns highest number from a1..aN.
min (a1..aN) - Returns lowest number from a1..aN.
print (text) - Prints text to log and on screen.
rnd (x, y) - Returns random number x..y1
rnd (x) - Returns random number 0..x1
rnd (x, y, p) - Returns random number x..y-1, with percenatge effect p.
rnd2 (x) - Returns random number (x/2)..x1
substr (str, pos, size) - Returns substring of string str.
sum (a1..aN) - Returns sumary of sum of a1..aN.
to10 (x) - Returns nearest highest value for x, which is cleat multiply of 10 (10,20,30,40,..)
trim (str) - Cuts all spaces from begin and end of string.
uc (str) - Converts strings to upper case.
avg (a1..aN) Returns averange value of a1..aN.
Parameters a1..aN - int - up to 20 parameters to sum.
Returns
charAt (str, pos) Returns character on position pos in string str.
charAt("Mario",0);
returns "M".
Parameters
Returns
exec (what) $s="echo(";
$s.="'die'";
$s.=");"
exec($s);
prints die on screen.
Parameters
indexOf (str, sub) Returns index of first postion of sub in str.
Parameters str - String
sub - String
Returns
lc (str) Converts strings to lower case.
uc("Mario");
returns "mario".
Parameters
Returns
see
length (str) Returns length of string s. All input is converted to string. For example, this :
length(123);
will return 3.
Parameters
Returns
max (a1..aN) Returns highest number from a1..aN.
Parameters a1..aN - int - up to 20 parameters to sum.
Returns
min (a1..aN) Returns lowest number from a1..aN.
Parameters a1..aN - int - up to 20 parameters to sum.
Returns
print (text) Prints text to log and on screen.
Parameters
rnd (x, y) Returns random number x..y-1
Parameters x - int - from value see doc
y - int - to value
Returns
rnd (x) Returns random number 0..x-1
Parameters
Returns
rnd (x, y, p) Returns random number x..y-1, but value will be near midle by z in %. For example:
rnd(1,12,0)
will return value near 1, but rnd(1,12,50)
will return value near 6 and rnd(1,12,95)
will return value near 11. This function is designed to return random value in skill of preson. For exmple in fights : $skill=actor:skill("HANDS");
$hit=rnd(1,20,$skill);
Parameters x - int - from value see doc
y - int - to value
p - int - percentage value
Returns
rnd2 (x) Returns random number (x/2)..x-1
Parameters
Returns
substr (str, pos, size) Returns substring of string str.
substr("Carlo",1,2);
returns "ar" and substr("Mario",2)
returns "rio".
Parameters str - String
pos - int - begin
size - int - max. size of text , default = to end of string
Returns
sum (a1..aN) Returns sumary of sum of a1..aN.
Parameters a1..aN - int - up to 20 parameters to sum.
Returns
to10 (x) Returns nearest highest value for x, which is cleat multiply of 10 (10,20,30,40,..)
Parameters
Returns
trim (str) Cuts all spaces from begin and end of string.
trim(" Ma rio ");
returns "Ma rio".
Parameters
Returns
uc (str) Converts strings to upper case.
uc("Mario");
returns "MARIO".
Parameters
Returns
see
Generated by Hideoshi's Documentation Tool on 28.10.2003 20:08:52