Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Plugins & Mods

Quests::Plugins & Mods Completed plugins for public use as well as modifications.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-17-2013, 05:11 AM
HnathBST
Sarnak
 
Join Date: Feb 2007
Location: Sunset Home
Posts: 71
Default BBCode like text parsing

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...
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:38 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3