What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » new and need some help

Pages: (3): « First [ 1 ] 2 3 » Last »
new and need some help
Author: Message:
debeste95
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2009
O.P. Undecided  new and need some help
hey all,
i just downloaded Messenger Plus! and also donwloaded some scripts (me and my friend are addicted to the pokemsn) and now i like to make my own scripts too
i have a little experience with programming such like GML (noob programming language for Game Maker) so i know the basics of coding
now i like to learn some things, so i could make my own scripts.
i like to start with some easy things, and need some help with that
i can't really find good tutorials to start with. i already did the help-file thingy with "starting with scripts" and i understood most of that
but if i want to make a little program, i go stuck...
can some1 just help me with simple things like this:
i wanna make a program that if some1 says something, my pc says: "blablablabla", just for starting with scripts...
but i thought i could make this with this event thingy:
code:
OnEvent_ChatWndReceiveMessage
but i already got stuck...
what do i have to fill in so if just the other person syas anything, my pc says "blablablabla". thanks for reading, i'm waiting for an answer! :)
12-21-2009 01:02 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: new and need some help
Hello debeste95
(Cool name! :P )

Event handlers, as these are called, are just functions with a specific name that Plus! recognises:

JScript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
    if(Origin !== Messenger.MyName) { // Check if we did not send the message
        MsgPlus.DisplayToast("","A contact has said something!");
        [whatever you want to do]
    }
    return Message; // We don't want to do anything with the Message
}

This will display a pop-up message in the bottom-right corner of the screen, titled "Messenger Plus! Live", saying "A contact has said something!"; no sound will be played when displaying the toast and it won't be clickable.

This post was edited on 12-21-2009 at 01:18 PM by SmokingCookie.
12-21-2009 01:15 PM
Profile PM Find Quote Report
debeste95
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2009
O.P. RE: RE: new and need some help
quote:
Originally posted by SmokingCookie
Hello debeste95
(Cool name! :P )

Event handlers, as these are called, are just functions with a specific name that Plus! recognises:

JScript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
    if(Origin !== Messenger.MyName) { // Check if we did not send the message
        MsgPlus.DisplayToast("","A contact has said something!");
        [whatever you want to do]
    }
    return Message; // We don't want to do anything with the Message
}

This will display a pop-up message in the bottom-right corner of the screen, titled "Messenger Plus! Live", saying "A contact has said something!"; no sound will be played when displaying the toast and it won't be clickable.
so when do i have to put 'if', and when do i have to put 'function' before the event?
çause in GML (it's a noob language, i know) you always use if, so i don't have any experience with function...
but i think this will work, much thanx, now i can try to make my own pokemon battler with uber-pro functiens etc. (kidding! :P)
12-21-2009 01:20 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: new and need some help
You put the "function" keyword in front of the name, simply because it is a function. JScript does support events, but in a very different way. Patchou has programmed Plus! try and to call these functions (if they exist in the JScript code) when the corresponding event occurs:

JScript code:
function HelloWorld() { // define function
    MSgPlus.DisplayToast("","Hello world!");
}

Hello world(); // call function

In the above code, a function, named HelloWorld(), is defined (i.e. "tell the scripting engine what the function does"). It displays a toast.

After defining the function, it is called: we tell the scripting engine to actually run the code inside the function: display a toast.

The "if" part checks whether the screen name of the contact who sent the message (the Origin parameter) is not the same as your screen name. In the latter case, the function is called directly upon OnEvent_ChatWndSendMessage(); this is again a function called when a specific action is performed: a message is sent by clicking the "Send" button in a conversation window.

code:
if(1 === 2) {
    MsgPlus.DisplayToast("","One is equal to Two!");
} else {
    MsgPlus.DisplayToast("","One is not equal to Two");
}


In the above code, the second toast is always displayed, as 1 is not the same as 2.

This post was edited on 12-21-2009 at 01:31 PM by SmokingCookie.
12-21-2009 01:25 PM
Profile PM Find Quote Report
debeste95
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2009
O.P. RE: RE: new and need some help
quote:
Originally posted by SmokingCookie
You put the "function" keyword in front of the name, simply because it is a function. JScript does support events, but in a very different way. Patchou has programmed Plus! try and to call these functions (if they exist in the JScript code) when the corresponding event occurs:

JScript code:
function HelloWorld() { // define function
    Messenger.DisplayToast("","Hello world!");
}

Hello world(); // call function

The "if" part checks whether the screen name of the contact who sent the message (the Origin parameter) is not the same as your screen name. In the latter case, the function is called directly upon OnEvent_ChatWndSendMessage(); this is again a function called when a specific action is performed: a message is sent by clicking the "Send" button in a conversation window.
i think i got it now...
so for every function in that help-file thingy you put 'function' instead of 'if'?
i'm gonna try some little things to learn more about it, thank you guys! :)
12-21-2009 01:31 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: new and need some help
Please note that I've made a mistake in the code, it should be MsgPlus.DisplayToast("","Hello world!");

Indeed, all these event things are just functions ;)

"if" checks whether something is true or not, you'll see more on MSDN (a scripter's best friend):

if...else statement @ MSDN

This post was edited on 12-21-2009 at 01:36 PM by SmokingCookie.
12-21-2009 01:33 PM
Profile PM Find Quote Report
debeste95
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2009
O.P. RE: new and need some help
thanx, man!
but now i have a problem... how do i get my script working? if my other scripts are automatically working, but i can't start my script. do i need to make a scriptinfo.xml first?
12-21-2009 01:37 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: new and need some help
View Script management ("Scriptbeheer"), click the "New" button, fill in a name, code your script (be sure to save regularly!) and if you're planning on distributing your script, you must indeed make a ScriptInfo.xml.
12-21-2009 01:41 PM
Profile PM Find Quote Report
debeste95
New Member
*


Posts: 11
– / Male / Flag
Joined: Dec 2009
O.P. RE: new and need some help
i already made my script, and i see the script name in that block ("negeerstand") :p
but if i press (omfg what's "toepassen" in english?)  then it says
"the script "negeerstand" can't be started, it got damaged(?) or you don't have permission" (translated from dutch)
all other scripts says: "started", but "negeerstand" doesn't :(
12-21-2009 01:47 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: new and need some help
Toepassen = to apply :P

Anyways, in this case, you need to edit the script; either click the Edit button, or open the script file(s ) in your favourite editor. A "damaged" script means there's a serious error. You might want to check the debugging window for more information on this specific error.
12-21-2009 01:50 PM
Profile PM Find Quote Report
Pages: (3): « First [ 1 ] 2 3 » 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