What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Replace Colour Codes

Pages: (3): « First « 1 [ 2 ] 3 » Last »
Replace Colour Codes
Author: Message:
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: Replace Colour Codes
I never saw any of those features in the old IRC codes of Msg+ but please correct me if I'm wrong...

If you want, you can erase them with this code
code:
strMyNewPSM = strMyNewPSM.replace(/\[c=([1-6]?\d|#[0-9A-Fa-f]{6})\](.*?)\[\/c(?:=(?:[1-6]?\d|#[0-9A-Fa-f]{6}))\]/g, "·\$$$1$2·\$")
strMyNewPSM = strMyNewPSM.replace(/\[a=(?:[1-6]?\d|#[0-9A-Fa-f]{6})\](.*?)\[\/a(?:=(?:[1-6]?\d|#[0-9A-Fa-f]{6}))\]/g, "$1")
strMyNewPSM = strMyNewPSM.replace(/^\s+/g, "");

If it finds a gradient only the starting color will be used...

This post was edited on 09-08-2006 at 04:48 PM by Shondoit.
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
09-08-2006 04:45 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: Replace Colour Codes
quote:
Originally posted by Shondoit
I never saw any of those features in the old IRC codes of Msg+ but please correct me if I'm wrong...
So? the request is to replace bbcode color tags with irc color tags. This means that ALL bbcode color tags should be replaced (supported in Plus!3 or not).

This post was edited on 09-08-2006 at 04:52 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
09-08-2006 04:51 PM
Profile PM Find Quote Report
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: Replace Colour Codes
So? They are replaced now... to replace it for gradients, would mean alot of ·$n codes, wich will boost your text length with umm, at least 300% :O
Unpractical

If he wants it, I could have a look at it

(btw, I saw the text you now edited out, please tell what didn't work, for learning purpose)
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
09-08-2006 04:57 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Replace Colour Codes
quote:
Originally posted by Shondoit
So? They are replaced now... to replace it for gradients, would mean alot of ·$n codes, wich will boost your text length with umm, at least 300% :O
Unpractical

If he wants it, I could have a look at it
That's not the point. I didn't say you need to simulate a gradient with irc codes (it would be cool though).

The request was to replace bbcode color codes, so they don't exist anymore in the string. This means if a gradient is done, that code should be replaced too (with whatever) and not be left in because "irc codes don't support gradients".

This is the same if you have a file saved in Word and you want to convert it to a textfile. You don't want to keep all the "not supporting" codes in it, they should be replaced too (with nothing; aka removed).

PS: as said, if hexadecimal color codes are used, Plus! will interpret the first 6 characters, but anything after that is ignored (as long as the string doesn't exceep 53 characters). So add ".{0,53}?" after each "[0-9A-Fa-f]{6}" (but they shouldn't be captured of course).

quote:
Originally posted by Shondoit
(btw, I saw the text you now edited out, please tell what didn't work, for learning purpose)
I removed it because a) I thought I was wrong in saying that, b) nobody replied yet.

but as a matter of fact, I wasn't wrong :D

1) "[1-6]?\d" should actually be "[0-9]{1,2}" or "\d{1,2}". Numbers from 0 to 99 are allowed.

2) the irc codes should contain 2 digits, not 1. 1 digit is possible to use, but may conflict with the actual string you try to color if it begins with a number. Same for backgrounds.


EDIT: blah... what SpunkyLoveMuff said below, while I was editing this :p

EDIT2: ".{0,53}" should be ".{0,53}?"

This post was edited on 09-09-2006 at 12:33 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
09-08-2006 05:07 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. RE: Replace Colour Codes
Yeah, I just needed [c=?] replaced with ·$? and I changed all the [/c] tags to ·$1. It is very unlikely people would want to use gradients in this script, however the hex values are something I may have to factor in. The only problem I have had with this is that if the string (for example) is: "[c=2]5 Days til...[/c]" it gets replaced by "·$25 Days til...·$1" giving the wrong colour and also removing part of the string... I added a space after the replacement value and this fixes the problem, but adds spaces that make the PSM look slightly wierd.  I'm adding an option to turn this function on and off so that there is always an alternative method.

Also, someone said there were a particular amount of colours (I think they said 62), I counted 54... The only reason I used a loop before was because I wasn't using RegExp so i was looping through replacing "[c="+i+"]" with "·$"+i

This post was edited on 09-08-2006 at 05:16 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
09-08-2006 05:15 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Replace Colour Codes
quote:
Originally posted by SpunkyLoveMuff
Also, someone said there were a particular amount of colours (I think they said 62), I counted 54

there are 67 colours.
09-08-2006 05:20 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. RE: Replace Colour Codes
Using the Format Codes button in the Display Name changer section of MSN gives a total of 56 colours to use ranging from 0 to 55 and then it uses hex codes to fill in the gaps from what I can tell...
<Eljay> "Problems encountered: shit blew up" :zippy:
09-08-2006 05:23 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Replace Colour Codes
quote:
Originally posted by SpunkyLoveMuff
It is very unlikely people would want to use gradients in this script
If the script doesn't support all kind of color tags, I frankly don't see why I should use this script tbh.

I though the purpose of such a script is to change bbcode color codes to irc color codes so contacts with Plus!3 can see the colors too (which I find an extreme good idea, don't get me wrong on that). This means the script should support all possebilities (ok, not right away, but it sure must be the goal in the end).

quote:
Originally posted by SpunkyLoveMuff
I'm adding an option to turn this function on and off so that there is always an alternative method.
instead of doing such a workaround it would be relativly easy to put a 0 in front of the singel digit numbers (as it should be anyways) by making the text used to replace as a function.

quote:
It is not so strait forward to make something like this (but no impossible; you just need to think about all the possebilities there are).


This post was edited on 09-08-2006 at 05:28 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
09-08-2006 05:24 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. RE: Replace Colour Codes
quote:
Originally posted by CookieRevised
If the script doesn't support all kind of color tags, I frankly don't see why I should use this script tbh.

The script is not primarily for this purpose, but I know several people that are testing it for me that use colours using the script. The reason I want to use IRC codes are because they take less space and so allow for longer strings and older versions of plus will still be able to read them properly.

EDIT: Personally, I prefer BBCode as you can nest tags etc. I just thought it would be nice to add support for IRC

This post was edited on 09-08-2006 at 05:28 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
09-08-2006 05:28 PM
Profile PM Find Quote Report
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: Replace Colour Codes
quote:
Originally posted by CookieRevised
The request was to replace bbcode color codes, so they don't exist anymore in the string. This means if a gradient is done, that code should be replaced too (with whatever) and not be left in because "irc codes don't support gradients".
I removed them already, didn't I?

quote:
Originally posted by CookieRevised
PS: as said, if hexadecimal color codes are used, Plus! will interpret the first 6 characters, but anything after that is ignored (as long as the string doesn't exceep 53 characters). So add ".{0,53}" after each "[0-9A-Fa-f]{6}" (but they shouldn't be captured of course).
Didn't know that, just thought it used standard colorcodes (a 6 char Hex val)

quote:
Originally posted by CookieRevised
1) "[1-6]?\d" should actually be "[0-9]{1,2}". Numbers from 0 to 99 are allowed.
The numbers are only relevant til a certain amount, after that, the standard is black...  But like you said, that doesn't mean it shouldn't be replaced

quote:
Originally posted by CookieRevised
2) the irc codes should contain 2 digits, not 1. 1 digit is possible to use, but may conflict with the actual string you try to color if it begins with a number. Same for backgrounds.
True, and I have no idea how to do this :S... unfortunately you can't check during the 'replace' call... But it should be possible, just have to take a closer look into it...

quote:
Originally posted by SpunkyLoveMuff
Yeah, I just needed [c=?] replaced with ·$? and I changed all the [/c] tags to ·$1.
Actually, you need to replace [/c] with ·$, because ·$1 will give you black, not the standard color (But that'll give problems with a number after it)

This post was edited on 09-08-2006 at 10:42 PM by Shondoit.
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
09-08-2006 10:40 PM
Profile PM Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On