Can someone edit this script a little |
Author: |
Message: |
Barathrum
Junior Member
.......................
Posts: 42
30 / /
Joined: Nov 2009
|
O.P. Can someone edit this script a little
code: /*
Colorize
Author Zanfo.Net
Date August 2008
*/
function OnEvent_Initialize(boh)
{
// Debug.DebuggingWindowVisible = true;
Shell = new ActiveXObject("WScript.Shell");
RegPrimoColore = MsgPlus.ScriptRegPath + "Color1";
RegSecondoColore = MsgPlus.ScriptRegPath + "Color2";
try
{
primoColore = Shell.RegRead(RegPrimoColore);
secondoColore = Shell.RegRead(RegSecondoColore);
}
catch (Exception)
{
Shell.RegWrite(RegPrimoColore, primoColore);
Shell.RegWrite(RegSecondoColore, secondoColore);
}
}
var version = 0.6;
var primoColore = 13;
var secondoColore = 58;
var Shell;
var RegPrimoColore;
var RegSecondoColore;
function OnGetScriptCommands()
{
var ScriptCommands = "<ScriptCommands>";
ScriptCommands += "<Command>";
ScriptCommands += "<Name>Colorize</Name>";
ScriptCommands += "<Description>Colorize all you write after</Description>";
ScriptCommands += "<Parameters>< Write here !></Parameters>";
ScriptCommands += "</Command>";
ScriptCommands += "<Command>";
ScriptCommands += "<Name>Colorize_SetThisName</Name>";
ScriptCommands += "<Description>Colorize your name!</Description>";
ScriptCommands += "<Parameters>< Write here !></Parameters>";
ScriptCommands += "</Command>";
ScriptCommands += "<Command>";
ScriptCommands += "<Name>Colorize_Config</Name>";
ScriptCommands += "<Description>Configure the numbers of the colours which will be used by Colorize. ONLY 'XX XX' FORMAT!! (use 'default' for default colours)</Description>";
ScriptCommands += "<Parameters><first_colour_number second_colour_number></Parameters>";
ScriptCommands += "</Command>";
ScriptCommands += "<Command>";
ScriptCommands += "<Name>Colorize_Check</Name>";
ScriptCommands += "<Description>Displays what colour-numbers are being used</Description>";
ScriptCommands += "</Command>";
ScriptCommands += "<Command>";
ScriptCommands += "<Name>Colorize_Demo</Name>";
ScriptCommands += "<Description>Displays what colour-numbers are possible to use</Description>";
ScriptCommands += "</Command>";
ScriptCommands += "<Command>";
ScriptCommands += "<Name>Colorize_About</Name>";
ScriptCommands += "<Description>About !</Description>";
ScriptCommands += "</Command>";
ScriptCommands += "</ScriptCommands>";
return ScriptCommands;
}
function OnEvent_ChatWndSendMessage(ChatWindow, Messaggio)
{
var stringaColorata = Messaggio.substr(0);
stringaColorata = "[c=" + primoColore + "]" + stringaColorata + "[/c=" + secondoColore + "]";
return stringaColorata;
if ((Messaggio.toUpperCase()).indexOf("/COLORIZE_SETTHISNAME ") == 0)
{
var stringaColorata = Messaggio.substr(22);
stringaColorata = "[c=" + primoColore + "]" + stringaColorata + "[/c=" + secondoColore + "]";
//return stringaColorata;
Messenger.MyName = stringaColorata;
return "";
}
if ((Messaggio.toUpperCase()).indexOf("/COLORIZE_CONFIG ") == 0)
{
if (Messaggio.substr(17,7).toUpperCase() == "DEFAULT")
{
primoColore = 13;
secondoColore = 58;
Shell.RegWrite(RegPrimoColore, primoColore);
Shell.RegWrite(RegSecondoColore, secondoColore);
return "";
}
var temp1 = Messaggio.substr(17, 2);
var temp2;
if (temp1.indexOf(" ") == -1)
temp2 = Messaggio.substr(20,2);
else temp2 = Messaggio.substr(19,2);
if (!isNaN(temp1))
{
if (!isNaN(temp2))
{
primoColore = parseInt(temp1);
if (primoColore<0)
primoColore = 0;
if (primoColore>67)
primoColore = 67;
//Debug.Trace(primoColore);
secondoColore = parseInt(temp2);
if (secondoColore<0)
secondoColore = 0;
if (secondoColore>67)
secondoColore = 67;
//Debug.Trace(secondoColore);
Shell.RegWrite(RegPrimoColore, primoColore);
Shell.RegWrite(RegSecondoColore, secondoColore);
return "";
}
}
MsgPlus.PlaySound("Error.wav");
return "";
}
if ((Messaggio.toUpperCase()).indexOf("/COLORIZE_DEMO") == 0)
{
var stringa = "";
for (var i = 0; i<=67;i++)
{
stringa += "[c=" + i + "]" + i + " [/c]" ;
}
return stringa;
}
if ((Messaggio.toUpperCase()).indexOf("/COLORIZE_CHECK") == 0)
{
return "First Color Number = [c=" + primoColore + "]" + primoColore + "[/c], Second Color Number= [c=" + secondoColore + "]" + secondoColore + "[/c]";
}
if ((Messaggio.toUpperCase()).indexOf("/COLORIZE_ABOUT") == 0)
{
return "Colorize " + version + " Script made by Zanfo.Net, Enjoy!!";
}
return Messaggio;
}
Currently this script colorizes every messege the owner sends in the conversation. Can someone edit it so that it will colorize for both owner and the guy that owner is taling to. Or atleast that it will colorize only for the guy that the owner talks too.
This post was edited on 02-20-2010 at 03:05 PM by Barathrum.
|
|
02-20-2010 03:04 PM |
|
|
billyy
Full Member
Posts: 103 Reputation: 1
37 / /
Joined: Feb 2010
Status: Away
|
RE: Can someone edit this script a little
shouldn't simply adding
js code: function OnEvent_ChatWndReceiveMessage(ChatWinndow, Origin, Messaggio, MessageType)
{
var stringaColorata = Messaggio.substr(0);
stringaColorata = "[c=" + primoColore + "]" + stringaColorata + "[/c=" + secondoColore + "]";
return stringaColorata;
}
[The script above has been edited since the response of matty, it was even worse before that.]
do it?
That way it should do exactly the same with the received message as with the send one right?
This post was edited on 02-20-2010 at 04:48 PM by billyy.
I'm new at this, so don't expect me to be usefull any
time soon. But if i behaved you could rep me
|
|
02-20-2010 03:18 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Can someone edit this script a little
quote: Originally posted by billyy
That way it should do exactly the same with the received message as with the send one right?
billyy, that won't work at all! Commands in the OnEvent_ChatWndReceiveMessage are not displayed. (Well unless the contact sent the command with // instead of / but that is a different case.) Also have you read the documentation at all? The message you return to the OnEvent_ChatWndReceiveMessage function has to be less or equal to the length of the original message or else it is truncated. This is a limitation as there is only enough memory allocated to a specific number of characters.
|
|
02-20-2010 03:41 PM |
|
|
billyy
Full Member
Posts: 103 Reputation: 1
37 / /
Joined: Feb 2010
Status: Away
|
RE: Can someone edit this script a little
hmm well i didn't read the script actualy, i just didn't know exactly what it did...
I tought it automaticly colorized all send messages so i tought it might work if you just used the same script to colorize all received messages :/
idk >_<
Edit:
So, i have read it and since i now have the knowledge of it being imposible to make OnEvent_ChatWndReceiveMessage's output contain more characters than the input is imposible...
It would not be possible to do what is asked here?
This post was edited on 02-20-2010 at 04:35 PM by billyy.
I'm new at this, so don't expect me to be usefull any
time soon. But if i behaved you could rep me
|
|
02-20-2010 03:58 PM |
|
|
whiz
Senior Member
Posts: 568 Reputation: 8
– / – /
Joined: Nov 2008
|
RE: Can someone edit this script a little
Surely OnEvent_ChatWndSendMessage() adds the colour codes for both users, since that changes the message before it's sent...
Then, if you don't want to see your message with those codes, use MsgPlus.RemoveFormatCodes().
|
|
02-20-2010 08:49 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Can someone edit this script a little
The OP wants the same colouring effect to happen on received messages that does on sent messages. Not possible.
|
|
02-20-2010 09:09 PM |
|
|
Barathrum
Junior Member
.......................
Posts: 42
30 / /
Joined: Nov 2009
|
O.P. RE: Can someone edit this script a little
So it's not possible or?
|
|
02-20-2010 10:01 PM |
|
|
djdannyp
Elite Member
Danny <3 Sarah
Posts: 3546 Reputation: 31
38 / /
Joined: Mar 2006
|
RE: Can someone edit this script a little
quote: Originally posted by Barathrum
So it's not possible or?
quote: Originally posted by matty
The OP wants the same colouring effect to happen on received messages that does on sent messages. Not possible.
|
|
02-20-2010 10:05 PM |
|
|
|