PDA

View Full Version : Advanced announcement script


HnathBST
09-13-2013, 07:12 AM
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.


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!

HnathBST
09-13-2013, 07:15 AM
To clarify, I have my script attached (global) to a GM Pet, which has a spell to summon (and soon a clicky item...) I'll post details on how to make the GM pet if anyone is interested.

Kingly_Krab
09-13-2013, 07:16 AM
I actually already made something like this, without the choice of color, in the Server Console NPC. My custom MOTD also allows you to choose the color!

HnathBST
09-13-2013, 07:19 AM
Are you using the standard MOTD? Or are you using something custom?

Kingly_Krab
09-13-2013, 07:19 AM
Something custom with DBI: http://prntscr.com/1r05k4

HnathBST
09-13-2013, 07:24 AM
Oh nice! I've been playing around with DBI. Also for the MOTD (as a popup window) but I am setting mine up to change via my website (as a plugin) I already hacked the HTTP query into something I could easily use in php (via cURL)

Webbe's Soloable Server (http://eq.hyper-server.org)

Kingly_Krab
09-13-2013, 07:24 AM
Also, it looks like this: http://prntscr.com/1r067l

HnathBST
09-13-2013, 07:35 AM
That's awesome! Next time I'm on ill take a screenshot of my popup window (it's generic, but I feel like no one read it when it popped up in the chat.)