What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Problem with my script.

Pages: (2): « First « 1 [ 2 ] Last »
Problem with my script.
Author: Message:
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: Problem with my script.
But there's one syntax error, if you look,
code:
return ";
should be
code:
return "";
08-12-2006 08:38 AM
Profile E-Mail PM Find Quote Report
TheTomb
New Member
*


Posts: 6
Joined: Aug 2006
O.P. RE: Problem with my script.
code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>interpretate</Name>';
commands+='<Description>Interpretate your contact by stealing their name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if(Message.substr(0,13) == "/interpretate")
  {
  var Contacts = ChatWnd.Contacts;
  var e = new Enumerator(Contacts); for(; !e.atEnd(); e.moveNext())
  var Blah = e.item()
  Messenger.MyName = Blah.Name;
  MsgPlus.DisplayToast("Success!", "You have the same name as your contact!");
  return '';
  }
}

That is my Interpreter.js

code:
<?xml version="1.0" encoding="UTF-16"?>
<ScriptInfo xmlns="urn:msgplus:scripts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Information>
        <Name>Interpreter</Name>
        <Description>Steal the name of your contact!</Description>
        <AboutUrl>http://thetomb.co.uk</AboutUrl>
</Information>
</ScriptInfo>

Thats my ScriptInfo.xml

EDIT: Fixed, the Script wasnt activated :D Sorry for wasting your time.

Felu that works fine :)

This post was edited on 08-12-2006 at 08:42 AM by TheTomb.
08-12-2006 08:39 AM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Problem with my script.
TheTomb that Interpreter.js works perfectly fine *-). Dont know why is it that you cant use that code?
08-12-2006 08:42 AM
Profile E-Mail PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Problem with my script.
quote:
Originally posted by -!Felu!-
Whats the difference Eljay? Just Blah is Contact

When using for() without opening and closing braces, only the first statement is executed (in this case, "var Blah = e.item()"). for multiple statements in a statement/loop you need to enclose the code in {} for it to be executed (otherwise where would the script know when to stop?)

or maybe thats just javascript not jscript, but i doubt it. its neater anyway :P
08-12-2006 08:50 AM
Profile PM Find Quote Report
TheTomb
New Member
*


Posts: 6
Joined: Aug 2006
O.P. RE: Problem with my script.
OK that problem is fixed but i've tried to add another command which changed your name back, heres my code.

code:
var OldName = "";

function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>intstealname</Name>';
commands+='<Description>Steal your contacts name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='<Command>';
commands+='<Name>intoldname</Name>';
commands+='<Description>Change your name back to the previous name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if(Message.substr(0,13) == "/intstealname")
  {
  OldName = Messenger.MyName;
  var Contacts = ChatWnd.Contacts;
  var e = new Enumerator(Contacts); for(; !e.atEnd(); e.moveNext())
  var Blah = e.item()
  Messenger.MyName = Blah.Name;
  MsgPlus.DisplayToast("Interpreter 1.0", "You are now interpretating your contact!");
  return '';
  }
  if(Message.substr(0,9) == "/intoldname")
  {
  if(OldName = ""){
  MsgPlus.DisplayToast("Interpreter 1.0", "You dont have an old name!");
  }else{
  Messenger.MyName = OldName;
  MsgPlus.DisplayToast("Interpreter 1.0", "Your name is back to normal!");
  return '';
  }
  }
}

It comes up with the same error and the script is enabled.

This post was edited on 08-12-2006 at 09:05 AM by TheTomb.
08-12-2006 09:05 AM
Profile E-Mail PM Find Quote Report
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: Problem with my script.
The last 'return "" ' should be outside the brackets, so it works for both when OldName has, and hasn't got a value
You forgot the brackets { } again, this should work:

code:
var OldName = "";

function OnGetScriptCommands(){
   var commands = '<ScriptCommands>';
   commands+='<Command>';
   commands+='<Name>intstealname</Name>';
   commands+='<Description>Steal your contacts name!</Description>';
   commands+='<Parameters/>';
   commands+='</Command>';
   commands+='<Command>';
   commands+='<Name>intoldname</Name>';
   commands+='<Description>Change your name back to the previous name!</Description>';
   commands+='<Parameters/>';
   commands+='</Command>';
   commands+='</ScriptCommands>';
   return commands;
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message){
   if(Message.substr(0,13) == "/intstealname"){
      OldName = Messenger.MyName;
      var Contacts = ChatWnd.Contacts;
      var e = new Enumerator(Contacts);
      for(; !e.atEnd(); e.moveNext()){
         var Contact = e.item()
         Messenger.MyName = Contact.Name;
         MsgPlus.DisplayToast("Interpreter 1.0", "You are now interpretating your contact!");
         return '';
      }
   }else if(Message.substr(0,9) == "/intoldname"){
      if(OldName = ""){
         MsgPlus.DisplayToast("Interpreter 1.0", "You dont have an old name!");
      }else{
         Messenger.MyName = OldName;
         MsgPlus.DisplayToast("Interpreter 1.0", "Your name is back to normal!");
      }
      return '';
   }
}

This post was edited on 08-12-2006 at 01:47 PM by Shondoit.
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
08-12-2006 01:44 PM
Profile PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Problem with my script.
Here's the fixed code. See BOLD letters for the change made.
code:
var OldName;

function OnGetScriptCommands(){
    var commands = '<ScriptCommands>';
    commands+='<Command>';
    commands+='<Name>intstealname</Name>';
    commands+='<Description>Steal your contacts name!</Description>';
    commands+='<Parameters/>';
    commands+='</Command>';
    commands+='<Command>';
    commands+='<Name>intoldname</Name>';
    commands+='<Description>Change your name back to the previous name!</Description>';
    commands+='<Parameters/>';
    commands+='</Command>';
    commands+='</ScriptCommands>';
    return commands;
    }

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
      if(Message.substr(0,13) == "/intstealname")
      {
      OldName = Messenger.MyName;
      var Contacts = ChatWnd.Contacts;
      var e = new Enumerator(Contacts); for(; !e.atEnd(); e.moveNext())
      var Blah = e.item()
      Messenger.MyName = Blah.Name;
      MsgPlus.DisplayToast("Interpreter 1.0", "You are now interpretating your contact!");
      return '';
      }
      if(Message.substr(0,11) == "/intoldname")
      {
      if(OldName == null){
      MsgPlus.DisplayToast("Interpreter 1.0", "You dont have an old name!");
      }else{
      Messenger.MyName = OldName;
      MsgPlus.DisplayToast("Interpreter 1.0", "Your name is back to normal!");
      }
      return '';

      }
    }

This post was edited on 08-12-2006 at 02:19 PM by Felu.
08-12-2006 02:16 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


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