This is a modified version to kingly_krab's announcement script. I like options, sometimes I want red, sometimes green, etc.
This also shows a more advanced example of perls regular expression matching.
Code:
sub EVENT_SAY
{
if($text =~ /announce (.{1,9}) ([01]) ([0-9]{1,3}) (.+)/i){
my %colors =(
"white"=>0,
"gray"=>1,
"blue"=>4,
"green"=>2,
"red"=>13,
"cyan"=>18,
"oocgr"=>260
);
my $color = $colors{$1};
my $char = $client->GetCleanName();
my $allZones = $2;
my $minStatus = $3;
my $message = $4;
if($client)
{
quest::gmsay("$char Announces: $message", $color, $allZones, 0, $minStatus);
}
}
}
}
I have mine assigned to a NPC who checks GM status before checking text.
To use, simply target and type:
announce <color> <send to world 1|0> <min status> message
Example:
announce red 1 0 The server is going down for reboot now!