L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2008, 06:27:46 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Module Requests > Topic: Relay coloring on recieving end.
Pages: 1 [2]   Go Down
« previous next »
Print
Author Topic: Relay coloring on recieving end.  (Read 802 times)
0 Members and 1 Guest are viewing this topic.
johskar
Rookie
**
Offline Offline

Posts: 50


Re: Relay coloring on recieving end.
« Reply #15 on: February 18, 2008, 08:10:46 PM »

it did recolor the stuff from those who was running the old version with coloring on sending side just fine atleast.... only bug it has is the coloring goes out on irc too, but we don't use irc so that's not an issue, but will probably get fixed... as for now, we are happy with the way it work Smiley
Logged
johskar
Rookie
**
Offline Offline

Posts: 50


Re: Relay coloring on recieving end.
« Reply #16 on: October 20, 2008, 12:50:56 PM »

dang! found some problems in the coloring stuff....
relay a single word that's in the coloring lists
like.... clan, omni, aqua or blue for instance it outputs
Code:
Testbot: [Test] Testchar: ##hrelayone_messageend##
the end## part comes in the color I just relayed the name of.

Here's the function:
Code:
/*
This gets called on commands in the external privgroup
*/
function extpgmsg($pgroup, $name, $msg)
{
foreach($this -> relays as $relaynum => $relayname)
{
$fsyntax = $this -> bot -> settings -> get('HRelay'.$relaynum, 'farSyntax');
//if (preg_match("/^" . $this -> bot -> commpre . "agcr /im", $msg) &&
if (preg_match("/^" .  $fsyntax . "agcr /im", $msg) &&
$this -> bot -> settings -> get('HRelay'.$relaynum, 'Status') &&
strtolower($this -> bot -> settings -> get('HRelay'.$relaynum, 'Relay')) == strtolower($pgroup))

/*
if (preg_match("/^" . $this -> bot -> commpre . "agcr /im", $msg) &&
$this -> bot -> settings -> get('HRelay'.$relaynum, 'Status'))
*/
{
$parts = explode(' ', $msg);
unset($parts[0]);
$txt = implode(' ', $parts);
            /* Hyde: parse out the Channel, Name and Message text, colorize it using the hrelayone colors */
if (preg_match("/\[<font color=#[ABCDEFabcdef0-9]{6}>([^\]]*)<\/font>\] <font color=#[ABCDEFabcdef0-9]{6}>([^\ ]*):<\/font> <font color=#[ABCDEFabcdef0-9]{6}>(.*)<\/font>$/", $txt, $matches) ||
{
$txtirc = "[" . $matches[1] . "]" . $matches[2] . ": " . $matches[3];
$txt_channel = ("##hrelay".$relayname."_channel##" . $matches[1] . "##end##");
$txt_name = ("##hrelay".$relayname."_name##" . $matches[2] . "##end##");
$txt_message = ("##hrelay".$relayname."_message##" . $matches[3] . "##end##");
$txt = "[" . $txt_channel . "] " . $txt_name . ": " . $txt_message;
}
if ($this -> bot -> settings -> get('HRelay'.$relaynum, 'Inc') == "Both" || $this -> bot -> settings -> get('HRelay'.$relaynum, 'Inc') == "Guildchat")
{
$this -> bot -> send_gc($txt);
}

if ($this -> bot -> settings -> get('HRelay'.$relaynum, 'Inc') == "Both" || $this -> bot -> settings -> get('HRelay'.$relaynum, 'Inc') == "Privgroup")
{
$this -> bot -> send_pgroup($txt);
}

if ($this -> bot -> settings -> get('HRelay'.$relaynum, 'Irc') == TRUE)
{
$this -> relay_to_irc2($txtirc);
}
}
}
}
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Relay coloring on recieving end.
« Reply #17 on: October 20, 2008, 02:30:29 PM »

I got tired of the whole mess and customized the module to strip all incoming color tags, parse out the relay guild name and character name, apply some proper color tags, then output to guild chat. All incoming messages get set to default bot colors, but orgs found this better than colors being all over the place.
Logged
johskar
Rookie
**
Offline Offline

Posts: 50


Re: Relay coloring on recieving end.
« Reply #18 on: October 20, 2008, 02:34:46 PM »

true, tho, what it's trying to do is 1st strip colors from incomming messages(cause some basts are slow on updating from the module we made1st that colors when you send.) and then add colors on the recieving end.
annyone know a simple way to do that?
what we use now feel kinda chubby way to do it Smiley
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Relay coloring on recieving end.
« Reply #19 on: October 20, 2008, 04:14:48 PM »

Problem is BeBot replaces it's internal color tags with HTML color tags before sending the message, so if you're looking for ##COLOR## and ##END##, it won't work.

Here's the function I came up with for getting rid of HTML font tags. This gets rid of all HTML font tags, not just colors. Use with caution if you use it outside of BeBot. Wink

Code: (php)
    /*
    Removes HTML font tags from a string.
    */
    function strip_font_tags($string)
    { // Start function strip_font_tags()
        // Getting rid of </font> is simple.
        $string = str_ireplace("</font>", "", $string);
        // Getting rid of opening font tags is not quite as simple.
        $pattern = "/<font.*?>/i";
        $replacement = "";
        $string = preg_replace($pattern, $replacement, $string);
        return $string;
    } // End function strip_font_tags()
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Relay coloring on recieving end.
« Reply #20 on: October 20, 2008, 04:16:07 PM »

And for reference, here's me recoloring relayed chat messages:

Code: (php)
    /*
    Apply the local bot's coloring to an incoming gcr message.
    */
    function recolor($string)
    { // Start function recolor()
        if (preg_match("/^\[(.+)\] (.+): (.+)$/i", $string, $parts))
        {
            $string = "##relay_channel##[".$parts[1]."]##end## ##relay_name##".$parts[2]."##end##: ##relay_message##".$parts[3]."##end##";
        }
        else if (preg_match("/^\[(.+)\] (.+)$/i", $string, $parts))
        {
            $string = "##relay_channel##[".$parts[1]."]##end## ##logon_organization##".$parts[2]."##end##";
        }

        return $string;
    } // End function recolor()

Logged
johskar
Rookie
**
Offline Offline

Posts: 50


Re: Relay coloring on recieving end.
« Reply #21 on: October 20, 2008, 06:35:49 PM »

it looks for <font></font> tags to nerf colors, just not sure why it screws up when you type singleword where that word is one of the "colors" like clan/aqua/orange and so on

gonna see if we can put them functions you posted there to work tomorrow Smiley
Logged
Pages: 1 [2]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Module Requests > Topic: Relay coloring on recieving end.
« previous next »
 
Jump to:  

Recent
Log playtime from buddys ...
by Temar
[Today at 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]

Delete member from Bot al...
by Alreadythere
[November 14, 2008, 12:17:54 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11034
Total Topics: 1495
Online Today: 15
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 2
Guests: 18
Total: 20
Threeze
healingpower

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.293 seconds with 28 queries. (Pretty URLs adds 0.027s, 4q)
Loading...