I created a little plugin that will parse SOME bbcodes (at the moment I've only been focusing on the popup window, chat will come next.)
text_parse.pl
Code:
sub ParseText
{
my $text = $_[0];
$text =~ s!\[color=([0-9a-z]+)\]([^\[\]]+)\[/color]!plugin::PWColor("$1")."$2</c>"!gie;
$text =~ s!\[color=(#[0-9a-z]{6})\]([^\[\]]+)\[/color\]!<c \"$1\" >$2</c>!gi;
$text =~ s!\[link=([\w|:|/|\.|\?|#|-]+)\]([^\[\]]+)\[/link\]!<a href=\"$1\">$2</a>!gi;
$text =~ s!\[br\]!<br />!gi;
$text =~ s!\[hr\]!plugin::PWBreak()!gie;
$text =~ s!^\[center\]([^\[\]]+)\[/center\]!plugin::PWAutoCenter($1)."<br />";!gie;
$text =~ s!\[center\]([^\[\]]+)\[/center\]!plugin::PWAutoCenter($1)."<br />";!gie;
return $text;
}
to use in a quest:
Code:
sub EVENT_SAY
{
if($text =~ /hail/i){
my $popup = "[*center]Look ma, I'm centering...[/center] and then the sky went [*color=Red]red[/color] [br] you can see [*color=#FF0066]more[/color] [link=http://google.com]here[/link] [hr]";
quest::popup("Text Parse Test:",plugin::ParseText($popup));
}
}
take the * out of the color= box and center ( otherwise it changes the color on the forums >.< )
This would result in:
http://prntscr.com/1rsrpx
Currently supported bbcodes are link,center,color (by name & hex),br & hr
you can change colors inside a center but you can't color a center...