Hello,
I have create a simple function to see the result of RemoveFormatCodes:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind) {
MsgPlus.DisplayToast("Test", ("abcdefghi" == MsgPlus.RemoveFormatCodes(Message)));
MsgPlus.DisplayToast("Test", MsgPlus.RemoveFormatCodes(Message));
}
But when I receive message colored with my script "Random Gradiator" (using Bidirectional Gradation mode), the result of first toast window is "false":
For example, i write:
abcdefghi
it was sent with format code and i see it with color but in the second toast window I see:
abcd efghi
I have tried to write manually the code generated by Random Gradiator :
MyMsg = "[.b][c=1]abcd[/c=2][c=2]efghi[/c=1][/b.]"
MsgPlus.DisplayToast("Test", MsgPlus.RemoveFormatCodes(MyMsg));
but in this way the message printed is correct (without spaces).
This is a function used by script to insert color codes:
msg1 = Messaggio.substr(0, Messaggio.length / 2);
msg2 = Messaggio.substr(Messaggio.length / 2);
return BIU_a[form] + "[c=" + c1 + "]" + msg1 + "[/c=" + c2 + "]" +
"[c=" + c2 + "]" + msg2 + "[/c=" + c1 + "]" + BIU_c[form];
where c1 and c2 are a numbers
BIU_a is an array with the open tag: [.b], [.i], [.u], etc...
BIU_c is an array with the close tag: [/b.], [/i.], [/u.], etc..
if you want see the source you can download it from:
http://www.msgpluslive.it/scripts/view/429-Random-Gradiator
Thanks
P.S.: I have add the dots in the tag to make it visible.