INNER CODE UNIT · JavaScript
msg
SethClydesdale/cunny-code · resources/javascript/arona.js:1230
var msg = message[Math.floor(Math.random() * message.length)], timeout = 0;
// to stop the same message from showing twice in a row, loop the RNG until it gives a new message
while (Arona[cache] == msg) {
msg = message[Math.floor(Math.random() * message.length)];
if (timeout++ > 1000) break; // break out if no different message could be chosen
}
// have Arona say the selected message
if (duration && callback) {
Arona.say(msg[0], msg[1] || 1, duration, callback);
} else if (duration) {
Arona.say(msg[0], msg[1] || 1, duration);
} else {
Arona.say(msg);
}
// cache current selection for comparison next time