Thread: Randomizing?
View Single Post
  #7  
Old 07-17-2012, 02:35 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
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.

Edit: The array approach looks a lot cleaner though. I must have missed that post. Use that method instead.
This is alright to do if you are learning how to use variables, but should never be done like that. Look at Chris's post.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote