What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Syntax error?

Syntax error?
Author: Message:
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. Syntax error?
Well i wanted my messenger to lock when messenger starts. So i wanted to make the script myself and then see if i could do it :P (it's really easy with the doc's after you read it).

So i manged to get to this:

code:
function OnEvent_Initialize(MessengerStart)
{
LockMessenger
true; Lock
);
}

function OnEvent_Uninitialize(MessengerExit)
{
}

But somethings wrong with line 5? I don't seem to notice what it is.

Can anyone help by explaining what's wrong as well has telling me whats wrong. It's a syntax error that was like that in the doc.

Also, can boolean be only true or false?
No longer here.
04-09-2009 09:32 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Syntax error?
Yeah because you are using the function all wrong.

LockMessenger is a function of the object MsgPlus.
LockMessenger as 1 parameter that accepts true or false.
true to lock WLM false to unlock it

js code:
function OnEvent_Initialize (bMessengerStart) {
    MsgPlus.LockMessenger (true);
}

And yes a boolean is either true or false nothing else.
04-09-2009 09:59 PM
Profile E-Mail PM Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. RE: Syntax error?
Oh, i see ;)

Get it now!

Thanks..
No longer here.
04-09-2009 10:01 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Syntax error?
First, this is how the script should be:
jscript code:
function OnEvent_Initialize(MessengerStart)
{
    MsgPlus.LockMessenger(true);
}

Now for an explanation :P

The way the function is represented in the Syntax section of the documentation isn't really representative of the way you use the code.

quote:
Originally posted by Scripting Docs => MsgPlus::LockMessenger

Syntax
code:
LockMessenger(
    [boolean] Lock
);


This is simply a form of IDL (Interface Definition Language), and is simply to inform developers of the parameters that a method takes and their types.

These functions are actually called in the following format:
code:
NameOfObject.MethodName(param1, param2... paramn);

In this case, the object is MsgPlus, the method name is LockMessenger, and it takes one boolean parameter. Therefore, to lock Messenger it would be called like so: (repeat of above code)
jscript code:
function OnEvent_Initialize(MessengerStart)
{
    MsgPlus.LockMessenger(true);
}

(note: I noticed matty already posted before I submitted this, but it took a while to type so fuck it :P)
04-09-2009 10:02 PM
Profile PM Find Quote Report
Quantum
Disabled Account
*****

Away.

Posts: 1055
Reputation: -17
31 / Male / Flag
Joined: Feb 2007
O.P. RE: Syntax error?
So whenever i use a function i need to use it with and object? (Like MsgPlus or Messenger)?
No longer here.
04-09-2009 10:06 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Syntax error?
Yes
04-09-2009 10:07 PM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Syntax error?
quote:
Originally posted by Quantum
So whenever i use a function i need to use it with and object? (Like MsgPlus or Messenger)?

Yes, but some of the objects are global such as Messenger and MsgPlus, whereas some have to be returned by another method such as ChatWnd or Contact.
This is explained along with a list of which objects are/aren't global in the "Objects Reference" page of the Scripting Docs.
04-09-2009 10:12 PM
Profile PM Find Quote Report
« 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