Thread: Randomizing?
View Single Post
  #8  
Old 07-17-2012, 06:48 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Jiroxys7 View Post
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(18))); 
The second will not work either, this.word is not a function, but you're treating it like one.
__________________
Reply With Quote