View Single Post
  #7  
Old 02-03-2012, 11:25 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Or, you can always use plugin::RandomSay() to make it really easy. Here is the plugin if you don't already have it. I keep it in a file named messages.pl, but not sure what it is on the plugin SVN offhand.

Code:
###Usage: plugin::RandomSay(chance(1-100), "message1","message2", etc..);
# Example: plugin::RandomSay(50, "I'll get you!", "Get over here!", "That's it!");
sub RandomSay {
	my $chance = $_[0];

	# First roll to see if a message will be sent or not depending on chance
	my $RandomNum = plugin::RandomRange(1, 100);
	
	# Choose the random message to send and send it
	if ($RandomNum <= $chance)
	{
		$MessageCount = @_;
		my $RandMessage = plugin::RandomRange(1, $MessageCount - 1);
		quest::say($_[$RandMessage]);
	}
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote