What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » hello world :D

hello world :D
Author: Message:
moudy
Junior Member
**


Posts: 19
37 / Male / Flag
Joined: Feb 2010
O.P. hello world :D
hello every one :D
I want to start my "hello world" in MPL scripting
I downloaded both the plus scripting documentation and jscript documentation.
Now I'm very new to all this...
my very first question is: how can I change the personal message ?
I know this :     Messenger::MyPersonalMessage
but don't know how to use it !!!
plus I would like to do a script that will toggle through values in a string and update the personal message.
And one more thing, how can I add control to my script, I mean, when i load my script, how can I add functionality to stop, run, etc...
Thanks in advance for the answers :D
02-22-2010 10:25 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: hello world :D
Welcome to the forums.

quote:
Originally posted by moudy
I want to start my "hello world" in MPL scripting
I downloaded both the plus scripting documentation and jscript documentation.
Now I'm very new to all this...
my very first question is: how can I change the personal message ?
I know this :     Messenger::MyPersonalMessage

Javascript code:
Messenger.MyPersonalMessage = 'Hello World! :)';


quote:
Originally posted by moudy
And one more thing, how can I add control to my script, I mean, when i load my script, how can I add functionality to stop, run, etc...

You could use a boolean variable to control the script.

Javascript code:
var bEnabled = false;


This post was edited on 02-22-2010 at 11:00 PM by matty.
02-22-2010 10:58 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: hello world :D
Hi there! :D

Well, if you don't have any experience with scripting or programming, I'd suggest learning the basics of JavaScript first. I usually recommend the tutorials on W3Schools, but in fact any tutorial site should be good.

Now, to avoid confusion later on, let me first explain the difference between JavaScript and JScript. Both languages are variants of the ECMAScript standard and are very similar regarding their syntax. JavaScript is used on the web for dynamic webpages and runs inside a web browser whereas JScript is mostly used in scripting environments such as the Messenger Plus! Live script engine. Because of their different environments, you don't have to go deeper into the web-specific side when learning JavaScript, just make sure you understand the basic building blocks such as variables, statements, expressions, condition blocks (if, else), loops (for, while) and functions. With those elements, you should have a good foundation to start learning scripting for Messenger Plus! Live. It's also a good idea to quickly have a look at how objects and classes in JavaScript work, as those are part of the main building blocks used in Plus! scripting.

When coding JavaScript for a browser, you'll have access to objects such as document and window to interact the current webpage. In a Plus! script, you get objects such as Messenger, MsgPlus and Interop to interact with Windows Live Messenger and Messenger Plus! Live. The scripting documentation describes what properties and methods you can access, what you can do with them and how they should properly be used. For example, Messenger.MyPersonalMessage is a string property which you can use to get or set the current user's personal message. Also make sure you read through the whole page since they can contain interesting practical information. In the case of the personal message, we should make sure that the current user is actually logged in. Or, in the case of sending a message through a chat window, we should make sure that the message text box is accessible.

The other key component of Plus! scripting are events. These allow you to respond to things that happen in Messenger. This can be a contact signing in, a message being received or the script menu being shown. In Plus! scripting, you can register an event by creating a function with the name of the event. Inside that function, you write the code you want to execute when that event is triggered and if required by the event, you return something. For example, to register a script command the user can type inside a chat window, you'd create a function OnEvent_ChatWndSendMessage and declare the parameter names, then you write the logic for looking for the command and finally your function should return something which will be sent in place of the command.

All of this is also thoroughly described in the scripting documentation's "Getting Started" section, therefore always keep the documentation files open while scripting. ;)

When you understand how scripts work and how you should write yours, it may be good practice to look at the code of other script developers and study how they do things. I'm not saying you should copy their code, but it can prove valuable to see how someone who has some more experience has tackled a certain problem. Don't go straight to the big, complex scripts (such as Screenshot Sender, Music Now Playing or Countdown Live) since those use pretty sophisticated mechanisms to get their advanced functionalities working, go for the simpler, smaller scripts first and work your way up. But most important: experiment! You learn things the fastest when you actually try to code it yourself. ;)

Woah, long post is long. Am I suffering from Cookie disease?
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-23-2010 06:31 PM
Profile E-Mail PM Web Find Quote Report
moudy
Junior Member
**


Posts: 19
37 / Male / Flag
Joined: Feb 2010
O.P. RE: RE: hello world :D
quote:
Originally posted by Matti
Hi there! :D

Well, if you don't have any experience with scripting or programming, I'd suggest learning the basics of JavaScript first. I usually recommend the tutorials on W3Schools, but in fact any tutorial site should be good.

Now, to avoid confusion later on, let me first explain the difference between JavaScript and JScript. Both languages are variants of the ECMAScript standard and are very similar regarding their syntax. JavaScript is used on the web for dynamic webpages and runs inside a web browser whereas JScript is mostly used in scripting environments such as the Messenger Plus! Live script engine. Because of their different environments, you don't have to go deeper into the web-specific side when learning JavaScript, just make sure you understand the basic building blocks such as variables, statements, expressions, condition blocks (if, else), loops (for, while) and functions. With those elements, you should have a good foundation to start learning scripting for Messenger Plus! Live. It's also a good idea to quickly have a look at how objects and classes in JavaScript work, as those are part of the main building blocks used in Plus! scripting.

When coding JavaScript for a browser, you'll have access to objects such as document and window to interact the current webpage. In a Plus! script, you get objects such as Messenger, MsgPlus and Interop to interact with Windows Live Messenger and Messenger Plus! Live. The scripting documentation describes what properties and methods you can access, what you can do with them and how they should properly be used. For example, Messenger.MyPersonalMessage is a string property which you can use to get or set the current user's personal message. Also make sure you read through the whole page since they can contain interesting practical information. In the case of the personal message, we should make sure that the current user is actually logged in. Or, in the case of sending a message through a chat window, we should make sure that the message text box is accessible.

The other key component of Plus! scripting are events. These allow you to respond to things that happen in Messenger. This can be a contact signing in, a message being received or the script menu being shown. In Plus! scripting, you can register an event by creating a function with the name of the event. Inside that function, you write the code you want to execute when that event is triggered and if required by the event, you return something. For example, to register a script command the user can type inside a chat window, you'd create a function OnEvent_ChatWndSendMessage and declare the parameter names, then you write the logic for looking for the command and finally your function should return something which will be sent in place of the command.

All of this is also thoroughly described in the scripting documentation's "Getting Started" section, therefore always keep the documentation files open while scripting. ;)

When you understand how scripts work and how you should write yours, it may be good practice to look at the code of other script developers and study how they do things. I'm not saying you should copy their code, but it can prove valuable to see how someone who has some more experience has tackled a certain problem. Don't go straight to the big, complex scripts (such as Screenshot Sender, Music Now Playing or Countdown Live) since those use pretty sophisticated mechanisms to get their advanced functionalities working, go for the simpler, smaller scripts first and work your way up. But most important: experiment! You learn things the fastest when you actually try to code it yourself. ;)

Woah, long post is long. Am I suffering from Cookie disease?

Thanks alot matty for the reply :)
I visit w3schools from time to time, and I benifit alot from there, but I'm not even close to be a good scripter.
Any way, I'm really interested to know how to make a menu for a script. I know I'm not going to do a menu soon :P, but Im really interested to know how !
thanks again for any reply :)
02-25-2010 07:15 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: hello world :D
quote:
Originally posted by moudy
Thanks alot matty for the reply :)
It was Matti not myself that posted that. But thanks ;)
02-25-2010 07:38 PM
Profile E-Mail PM Find Quote Report
moudy
Junior Member
**


Posts: 19
37 / Male / Flag
Joined: Feb 2010
O.P. RE: RE: hello world :D
quote:
Originally posted by matty
quote:
Originally posted by moudy
Thanks alot matty for the reply :)
It was Matti not myself that posted that. But thanks ;)
oups *-)
typo mistake 8-|
02-25-2010 07:43 PM
Profile E-Mail PM Web 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