collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Relay coloring on recieving end.  (Read 7858 times)

0 Members and 1 Guest are viewing this topic.

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #15 on: February 19, 2008, 02:10:46 am »
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 :)
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #16 on: October 20, 2008, 07: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: [Select]
Testbot: [Test] Testchar: ##hrelayone_messageend##the end## part comes in the color I just relayed the name of.

Here's the function:
Code: [Select]
/*
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);
}
}
}
}
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #17 on: October 20, 2008, 09: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.

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #18 on: October 20, 2008, 09: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 :)
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #19 on: October 20, 2008, 11: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. ;)

Code: (php) [Select]
    /*
    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()

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #20 on: October 20, 2008, 11:16:07 pm »
And for reference, here's me recoloring relayed chat messages:

Code: (php) [Select]
    /*
    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()


Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #21 on: October 21, 2008, 01:35:49 am »
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 :)
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 191
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal