Quote:
Originally Posted by Jiroxys7
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.
|
Neither of these are going to work anyway. With the first, you're appending the random number to the value of this.word, which is undefined, and then saying it. If you wanted to append to the variable name, you'd want to do...
PHP Code:
this.chat = this.(@ "word" @ int(random(1, 8)));
The second will not work either,
this.word is not a function, but you're treating it like one.