View Single Post
  #3  
Old 06-07-2010, 03:05 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I added a new chance field to the script I posted above as well as simplified them a bit.

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]);
	}
}

###Usage: plugin::RandomEmote(chance(1-100), "message1","message2", etc..);
# Example: plugin::RandomEmote(50, "dies", "falls to the ground", "keels over dead");
sub RandomEmote {
	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::emote($_[$RandMessage]);
	}
}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 12-13-2010 at 11:16 AM..
Reply With Quote