Can someone please tell me what's wrong with this script. It is meant to make your text a gradient for the people you select. It also uses the commands /colour1 /colour2 for the colours of the gradient and /contact to be able to send the gradient to that contact and /contactdelete to remove the contaact from being able to receive the gradient text. It is also not meant to work when you are writing a command but work when you have "//" at the begining of your message. Thanks in advance.
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
var ChatWndContacts = ChatWnd.Contacts;
if(ChatWndContacts.Count == 1)
{
var e = new Enumerator(ChatWndContacts);
var Contact = e.item();
var WSH = new ActiveXObject('WScript.Shell');
try
{
WSH.RegRead(MsgPlus.ScriptRegPath + Contact.Email);
Debug.Trace(MsgPlus.ScriptRegPath + "numberofpies exists.");
var WSH = new ActiveXObject('WScript.Shell');
colour1no = WSH.RegRead(MsgPlus.ScriptRegPath + "colour1");
var WSH = new ActiveXObject('WScript.Shell');
colour2no = WSH.RegRead(MsgPlus.ScriptRegPath + "colour2");
if (Message.charAt(0) == '/')
{
if(Message.charAt(1) == '/')
{
ChatWnd.SendMessage("[c" + colour1no + "]" + Message + "[/c=" + colour2no + "]");
}
return Message;
}
ChatWnd.SendMessage("[c" + colour1no + "]" + Message + "[/c=" + colour2no + "]");
}
catch (e)
{
Debug.Trace(MsgPlus.ScriptRegPath + "numberofpies doesnt exists.");
ChatWnd.SendMessage(Message)
}
}
Debug.Trace(MsgPlus.ScriptRegPath + "number of contacts more than one");
}
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage) {
if(sMessage.charAt(0) == "/"){
return parseCommands(sMessage,ChatWnd);
}
}
function parseCommands(sMessage,ChatWnd){
var ChatWndContacts = ChatWnd.Contacts;
if(ChatWndContacts.Count == 1)
{
var e = new Enumerator(ChatWndContacts);
var Contact = e.item();
if (sMessage.charAt(0) == '/'){
if(sMessage.charAt(1) == '/'){
return sMessage;
} else {
var firstSpace = sMessage.search(' ');
if(firstSpace == -1){
var command = sMessage.toLowerCase().substr(1);
var params = '';
} else {
var command = sMessage.toLowerCase().substr(1, firstSpace-1);
var params = sMessage.substr(firstSpace+1);
}
if(params != "") { Debug.Trace("The command \"" + command + "\" with the parameters \"" + params + "\" has been parsed."); }
else { Debug.Trace("The command \"" + command + "\" has been parsed."); }
switch(command) {
case 'colour1':
var colour1no = params
{
new ActiveXObject('WScript.Shell').RegWrite(MsgPlus.ScriptRegPath + "colour1",colour1no);
}
sMessage = '';
break;
case 'colour2':
var colour2no = params
{
new ActiveXObject('WScript.Shell').RegWrite(MsgPlus.ScriptRegPath + "colour2",colour2no);
}
sMessage = '';
break;
case 'contact':
var Message = params
{
new ActiveXObject('WScript.Shell').RegWrite(MsgPlus.ScriptRegPath + Contact.Email,Message);
}
sMessage = '';
break;
case 'contactdelete':
{
new ActiveXObject('WScript.Shell').RegDelete(MsgPlus.ScriptRegPath + Contact.Email);
}
sMessage = '';
break;
default:
}
}
}
return sMessage;
}
}
function OnGetScriptCommands()
{
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>colour1</Name>';
commands+='<Description>'+"First colour for gradient"+'</Description>';
commands+='<Parameters>Message</Parameters>';
commands+='</Command>';
commands+='<Command>';
commands+='<Name>colour2</Name>';
commands+='<Description>'+"Second colour for gradient"+'</Description>';
commands+='<Parameters>Message</Parameters>';
commands+='</Command>';
commands+='<Command>';
commands+='<Name>contact</Name>';
commands+='<Description>'+"Add contact to receive gradient message list"+'</Description>';
commands+='<Parameters>Message</Parameters>';
commands+='</Command>';
commands+='<Command>';
commands+='<Name>contactdelete</Name>';
commands+='<Description>'+"Remove contact from receive gradient list"+'</Description>';
commands+='<Parameters>Message</Parameters>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}
Edit: you must also set the colours and a contact before being able to use the script properly