Try something like this:
PHP Code:
function onPlayerTouchsMe() {
this.word1 = "Hey";
this.word2 = "Hi";
this.word3 = "How";
this.word4 = "Are";
this.word5 = "You";
this.word6 = "To";
this.word7 = "Day?";
this.speech = this.word @ int(random(1,7)+0.5);
this.chat = this.speech;
}
I think that's what you need. Or maybe it was this?
PHP Code:
this.word(@ int(random(1,7)+0.5));
I switched this.chat# with this.word# just to be on the safe side. I try to avoid getting custom variables mixed up with built-in variables.
Edit: The array approach looks a lot cleaner though. I must have missed cbk's post. Use that method instead.