[Request] Script to make sent messages gradient |
Author: |
Message: |
t_pass6
New Member
Posts: 12
Joined: Jun 2006
|
O.P. RE: [Request] Script to make sent messages gradient
Yes, but i need to have properties about contatcs, so it is good the way it put it. But i have some problem with this code :
code: var Color1 = null;
var Color2 = null;
var MsgOutput = null;
function Replace_Text(Color1, Color2, Message, MsgOutput)
{
if (Message.charAt(0) == '/')
{
return Message;
}
Debug.Trace("Vérification du premier caractère du message terminée");
MsgOuput = "[c=" + Color1 + "]" + Message + "[/c=" + Color2 + "]";
Debug.Trace("Remplacement du message éffectué");
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
var Contact = ChatWnd.Contacts;
var Num = new Enumerator(Contact);
Debug.Trace("Enumération des Contacts Terminée");
MsgOutput = Message;
if (Num < 2)
{
Debug.Trace("Vérification du nombre de contacts Terminée");
MsgOutput = Message
if ( Contact.EMail == 'xxx@yyy.zzz') {
Debug.Trace("Vérification de l'Email du contact terminée");
Color1 = "#000000";
Color2 = "#FFFFFF";
Debug.Trace("Définition des couleurs Terminée");
Replace_Text(Color1, Color2, Message, MsgOutput);
}
}
return MsgOutput;
Debug.Trace("Envoi du Message");
}
It goes no further than : Debug.Trace("Enumération des Contacts Terminée");
Does anyone see why?
P.S. : traces are in french, because i'm french
|
|
06-26-2006 11:28 AM |
|
|
Ezra
Veteran Member
Forgiveness is between them and God
Posts: 1960 Reputation: 31
37 / /
Joined: Mar 2003
|
RE: [Request] Script to make sent messages gradient
Why don't you just use mine?
I tested it now, and it works perfectly...
EDIT: This on supports more contacts more easily
code: var MsgOutput = null;
var Color1 = null;
var Color2 = null;
var sendUnaltered = true;
function Replace_Text(Color1, Color2, Message, MsgOutput)
{
return "[c=" + Color1 + "]" + Message + "[/c=" + Color2 + "]";
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();
switch(Contact.Email)
{
case "alpha@web2messenger.com":
Color1 = "#000000";
Color2 = "#FFFFFF";
return Replace_Text(Color1, Color2, Message, MsgOutput);
break;
case "beta@web2messenger.com":
Color1 = "#FFFFFF";
Color2 = "#000000";
return Replace_Text(Color1, Color2, Message, MsgOutput);
break;
default:
return Message;
}
}
}
This post was edited on 06-26-2006 at 11:43 AM by Ezra.
|
|
06-26-2006 11:33 AM |
|
|
t_pass6
New Member
Posts: 12
Joined: Jun 2006
|
O.P. RE: [Request] Script to make sent messages gradient
because i want to use it only in conversation with one contact not several, and your script works for both of the cases.
|
|
06-26-2006 11:42 AM |
|
|
Ezra
Veteran Member
Forgiveness is between them and God
Posts: 1960 Reputation: 31
37 / /
Joined: Mar 2003
|
RE: [Request] Script to make sent messages gradient
Oh, allright I see...
This one will only use gradients when there is 1 contact in the conversation else it will gradient based on the specific contact:
code: var MsgOutput = null;
var Color1 = null;
var Color2 = null;
var sendUnaltered = true;
function Replace_Text(Color1, Color2, Message, MsgOutput)
{
return "[c=" + Color1 + "]" + Message + "[/c=" + Color2 + "]";
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts);
if(Contacts.Count == 1)
{
for(; !e.atEnd(); e.moveNext())
{
var Contact = e.item();
switch(Contact.Email)
{
case "alpha@web2messenger.com":
Color1 = "#000000";
Color2 = "#FFFFFF";
return Replace_Text(Color1, Color2, Message, MsgOutput);
break;
case "beta@web2messenger.com":
Color1 = "#FFFFFF";
Color2 = "#000000";
return Replace_Text(Color1, Color2, Message, MsgOutput);
break;
default:
return Message;
}
}
}
else
{
return Message;
}
}
|
|
06-26-2006 11:46 AM |
|
|
demajen
New Member
Posts: 1
43 / / –
Joined: Jun 2006
|
RE: [Request] Script to make sent messages gradient
If your contact doesn't have MSGPLUSLIVE installed, will they see the colour codes in their window, or not? At the moment, without scripts, my contacts who don't have it see [ c=1 ] and [ /c=4] tags and I don't want em too. I figured this was best place to ask. =)
|
|
06-26-2006 06:18 PM |
|
|
Dally
New Member
Posts: 7
Joined: Jun 2006
|
RE: RE: [Request] Script to make sent messages gradient
quote: Originally posted by demajen
If your contact doesn't have MSGPLUSLIVE installed, will they see the colour codes in their window, or not? At the moment, without scripts, my contacts who don't have it see [ c=1 ] and [ /c=4] tags and I don't want em too. I figured this was best place to ask. =)
I also discovered this, isn't there anyway that non messenger plus users do not see these colour codes infront of every message I send.
|
|
06-26-2006 06:47 PM |
|
|
t_pass6
New Member
Posts: 12
Joined: Jun 2006
|
O.P. RE: [Request] Script to make sent messages gradient
I don't think that there is a way to know if a contact has Messenger Plus or not, you just have to add the contacts who have MsgrPlus to the Switch cases list, and they will see it, but if someone doesn't have his adress in the cases list the message will be sent like a normal message (default case). There is also a small modification of the code ezra made, because you have to check if the message is a command or not. You just have to add a condition to the Replace_Text function like this :
code: function Replace_Text(Color1, Color2, Message, MsgOutput)
{
if (Message.charAt(0) == '/')
{
return Message;
}
else{
return "[c=" + Color1 + "]" + Message + "[/c=" + Color2 + "]";
}
}
This post was edited on 06-27-2006 at 01:35 PM by t_pass6.
|
|
06-27-2006 01:34 PM |
|
|
pags2k7
New Member
Posts: 1
Joined: Jun 2006
|
RE: [Request] Script to make sent messages gradient
what about 3 colors?
|
|
06-27-2006 04:28 PM |
|
|
mathieumg
Full Member
Posts: 181 Reputation: 2
35 / /
Joined: May 2004
|
RE: [Request] Script to make sent messages gradient
You'd have to code your own gradient script for that, way more complicated
Official MessengerPlus! Live French Translator
Official StuffPlug 3 French Translator
|
|
06-27-2006 04:30 PM |
|
|
hmaster
Senior Member
Posts: 716 Reputation: 24
33 / /
Joined: Nov 2004
|
RE: [Request] Script to make sent messages gradient
Or you could split the message into 2 parts and do
[c=1]FirstPart[/c=2][c=2]SecondPart[/c=3]
Should be easy to count the number of chars divide by two and substr it
This post was edited on 06-27-2006 at 05:02 PM by hmaster.
|
|
06-27-2006 05:02 PM |
|
|
Pages: (4):
« First
«
1
2
[ 3 ]
4
»
Last »
|
|