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

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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-17-2013, 05:38 AM
HnathBST
Sarnak
 
Join Date: Feb 2007
Location: Sunset Home
Posts: 71
Default Slight modification to plugin::PWAutoCenter

I modified PWAutoCenter to not count html & bbcode tags when centering

Code:
sub PWAutoCenter{
        $Cent = $_[0];
        $len = $_[0];
        $len =~ s!<(?:[^>]+)>([^<]+)</(?:[^>]+)>!$1!gi;
        $len =~ s!\[(?:[\]]+)\]([^\[]+)\[/(?:[\]]+)\]!$1!gi;
        $SendCharLength = $_[1];
        if($SendCharLength != 2){
                $CentLength = length($len);
                $IC = (53 - ($CentLength * .80) - 4);
        }
        else{
                $IC = $Cent;
        }
        my $n = 0;
        my $Result = "";
        while ($n < $IC){
                $Result .= "&nbsp;";
                $n++;
        }
        if(!$SendCharLength){
                return "$Result $Cent";
                my $CentLength = 0;
        }
                elsif($SendCharLength == 2){
                        return "$Result";
                }
                        else{
                                return "There are $IC characters in this phrase, use this arguement for Option 2 in Arguement 2";
                        }
        my $SendCharLenghth = undef;
        my $CentLenght = undef;
}
if you don't need the BBCode [..]..[/..] remove the third $len. This will center links.

hope this helps someone
Reply With Quote
Reply


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 07:47 PM.


 

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