Can someone edit this script a little - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Can someone edit this script a little (/showthread.php?tid=93903)
Can someone edit this script a little by Barathrum on 02-20-2010 at 03:04 PM
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.
RE: Can someone edit this script a little by billyy on 02-20-2010 at 03:18 PM
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?
RE: Can someone edit this script a little by matty on 02-20-2010 at 03:41 PM
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.
RE: Can someone edit this script a little by billyy on 02-20-2010 at 03:58 PM
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?
RE: Can someone edit this script a little by whiz on 02-20-2010 at 08:49 PM
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().
RE: Can someone edit this script a little by matty on 02-20-2010 at 09:09 PM
The OP wants the same colouring effect to happen on received messages that does on sent messages. Not possible.
RE: Can someone edit this script a little by Barathrum on 02-20-2010 at 10:01 PM
So it's not possible or?
RE: Can someone edit this script a little by djdannyp on 02-20-2010 at 10:05 PM
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.
|