27706
Modification Help / Re: Detecting a strings length.
« on: May 25, 2009, 12:10:04 AM »Code: (TS) [Select]
PossibleItem[1] = "";
PossibleItem[2] = "";
PossibleItem[3] = "";
function giverandomitem(%client)
{
%randomkey = mCeil(getrandom() * 3));
%client.quantity[%randomKey] += mCeil(getrandom() * 10);
}We use "%randomKey" to grab a random array key between 0 and 3, and round it up into an integer.
We use getrandom() to produce a random floating point decimal in between 0 and 1.
We multiply that by 10, so that it's between 0 and 10.
And we round it up so that it's an integer.