Shoutbox

hello world :D - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: hello world :D (/showthread.php?tid=93931)

hello world :D by moudy on 02-22-2010 at 10:25 PM

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


RE: hello world :D by matty on 02-22-2010 at 10:58 PM

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

js 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.

js code:
var bEnabled = false;

RE: hello world :D by Matti on 02-23-2010 at 06:31 PM

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?


RE: RE: hello world :D by moudy on 02-25-2010 at 07:15 PM

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 :)
RE: hello world :D by matty on 02-25-2010 at 07:38 PM

quote:
Originally posted by moudy
Thanks alot matty for the reply :)
It was Matti not myself that posted that. But thanks ;)
RE: RE: hello world :D by moudy on 02-25-2010 at 07:43 PM

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-|