Thread: Randomizing?
View Single Post
  #6  
Old 07-17-2012, 02:31 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
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.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote