quote:
Originally posted by SmokingCookie
Uhm.. Please let me think for another 10 seconds....
EDIT::
Change the last function to:code:
var Index = new Array();
function RandomMessage() {
Index[0] = Math.random().charAt(4); // could be any number between 2 and 18
Index[1] = Math.random().charAt(7); // // could be any number between 2 and 18
Index[2] = Math.random().substr(Index[0],Index[1]); // Please note!! You need 99 messages, or the chat will send "undefined";
return RandomMessages[Index[2]];
}
ermmm... that is the most "original" method I've seen to get a random number between x and y...
The proper way would be to multiply the random number (which is always a decimal number between 0 and 1) with a certain upper bound number to enlarge it, and maybe add another lower bound number to start the random number from...
Math.floor((
upperbound -
lowerbound + 1) * Math.random() +
lowerbound);
see "
CookieRevised's reply to [Request] Random Number Generator"...
And you might also check "
CookieRevised's reply to Random numbers, prevent from being used more than once" for a snippet very related to this random message sending stuff...
Anyways, the script you've posted so far doesn't work at all like Aztek wanted.
Sorry to be so negative though...
But way cool that you at least tried to help.
Anyways, Aztek, did you already checked the
official scripting Database? I wouldn't be surprised if the script you ask for already exists...