What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Solved] What is wrong with my script?

[Solved] What is wrong with my script?
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
O.P. Huh?  [Solved] What is wrong with my script?
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

This post was edited on 07-14-2006 at 05:25 AM by markee.
[Image: markee.png]
07-13-2006 08:36 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Solved] What is wrong with my script? - by markee on 07-13-2006 at 08:36 AM
RE: [Help] What is wrong with my script? - by -dt- on 07-13-2006 at 08:52 AM
RE: RE: [Help] What is wrong with my script? - by markee on 07-13-2006 at 09:22 AM
RE: [Help] What is wrong with my script? - by markee on 07-14-2006 at 05:24 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On