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 7860 times)

0 Members and 3 Guests are viewing this topic.

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Relay coloring on recieving end.
« on: January 27, 2008, 05:09:46 am »
Not realy a module request tho but....
Me and the girlfriend patched together a relay module by disecting the orignal Relay_GUILD.php and patching it up again as a separate module to use in an alliance relay, where we now need to find a way to set colors on the recieving end instead of the transmitting side and hope someone can help us with that....

Annyhow, the code is attatched to this message and it's probably  messy as hell, but it works werry well for our now 10bot and growing relay network, and now we hope you lot can help us out on the coloring part as it's "fun" watching the rainbows as all the senders are sending their own defined colors to the rest of the alliance:)


"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #1 on: January 27, 2008, 01:38:36 pm »
Interesting idea.

To colorize on the receiving side you need to remove the color tags added on the sending side before relaying (or just remove those you don't want anymore), those are in one of the relay_to_xyz() functions. Just check where the color schemes are used.
On the receiving side you then need to check the sender against your color list and simply add the color tags you want before calling the send_output() function.

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #2 on: January 27, 2008, 08:26:40 pm »
that would color the entire thing with the same color or would it then be possible to split the message in to different colors like when we assemble it before it is sent?
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #3 on: January 27, 2008, 08:40:52 pm »
You will have to parse the incoming relayed chat if you want to color it differently depending on the parts, most likely something like checking for text between [] for the guild name and text between ] and : for the character name.
Something like preg_match("/^[(.+)] (.+): (.+)$/i", $msg, $info) would give you org string in $info[1], name of the sending character in $info[2] and the chat in info[3]. Not sure if [] and : need to be escaped in the regular expression...
You may have to check for <font color=""></font> tags in the incoming chat too...

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: Relay coloring on recieving end.
« Reply #4 on: January 27, 2008, 08:47:54 pm »
won't it be easier to set colour in bot that sends using ##".$this -> bot -> settings -> get(   )."## text ##end##

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #5 on: January 27, 2008, 08:51:09 pm »
That's the easiest way, true.

Though as I understand it johskar wants a solution working on the receiving bot, I guess that's the only one he can control.

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: Relay coloring on recieving end.
« Reply #6 on: January 27, 2008, 09:00:19 pm »
well if he want to colour the bots on recieveing end then maybe a good way is prob set a colour too a botname then have it use that colour for relays from that bot

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: Relay coloring on recieving end.
« Reply #7 on: January 27, 2008, 09:46:53 pm »
i had a good idea!
At the moment im at work using my mobile
I finish in 2 hours then ill do it and post it for you

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: Relay coloring on recieving end.
« Reply #8 on: January 28, 2008, 12:51:51 am »
ok i havnt done what you want as im not sure exactly what you want
but i did notice a big problem with ur module
u repeat WAY TOO MUCH
i have changed it so it doesnt repeat code
and adding more bots too your code is very simple , you only have to edit 1 line ;D

module is about 1/3 the original size now :p
« Last Edit: January 28, 2008, 08:17:25 am by Temar »

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #9 on: January 28, 2008, 05:08:08 am »
well if he want to colour the bots on recieveing end then maybe a good way is prob set a colour too a botname then have it use that colour for relays from that bot
so for ONE relay wich contains over 10 bots we'd then have to set the color on each of those even tho it's intended that those are going to use the same color?
the relay module has 5 separate relays, on wich each can use ither a tell to ONE bot or a privgroup to talk to multiple bots
"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 #10 on: January 28, 2008, 05:09:56 am »
ok i havnt done what you want as im not sure exactly what you want
but i did notice a big problem with ur module
u repeat WAY TOO MUCH
i have changed it so it doesnt repeat code
and adding more bots too your code is very simple , you only have to edit 1 line ;D

module is about 1/3 the original size now :p
Yes it's a dirty code, but it was working well ;P (except for the coloring)

Thank you for the shrinking code, but with your version I get this error:
Code: [Select]
Parse error: syntax error, unexpected T_FOREACH in /<removedpath>/Alliance_Relay.php on line 70
« Last Edit: January 28, 2008, 05:54:44 am by johskar »
"Ubuntu" is an ancient African word, meaning "I can't configure Slackware"

Offline Temar

  • Contributor
  • *******
  • Posts: 1140
  • Karma: +0/-0
    • AoFiles
Re: Relay coloring on recieving end.
« Reply #11 on: January 28, 2008, 08:18:16 am »
Yer was untested, i had some probs connecting to my server,
anyway i removed the few typos and tested it loads

Offline Heffalomp

  • BeBot Apprentice
  • ***
  • Posts: 80
  • Karma: +0/-0
Re: Relay coloring on recieving end.
« Reply #12 on: January 28, 2008, 05:59:03 pm »
The way I/We want it is that it colors the messages it recieve from each channel separately, instead of when it sends it, cause then each guild can choose what color they want on their separate relays, but have the same color on every guild in the same relay, this so that we don't spam in all of the colors in the rainbow when we are chatting, like we do now, cause some has set colors and some have not.

Your module works after fix btw, ty :)
"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 #13 on: February 18, 2008, 08:15:02 pm »
This is what we ended up with in the end :)
(well.. haven't cleaned out stuff that's commented out due to not being in use annymore yet tho ::))
"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 #14 on: February 18, 2008, 11:08:36 pm »
The send_output function does not have support for removing color tags, but if I recall correctly the send_tell function does. Check Bot.php to be sure...

This won't remove color tags that were added before you passed your output string to send_tell, it just prevents send_tell from adding color tags. If you want to remove all color tags you would have to remove them from your string before sending the string to send_tell...

 

* 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: 73
  • 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