What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Code

Pages: (2): « First [ 1 ] 2 » Last »
[Help] Code
Author: Message:
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. [Help] Code
How come this isnt working
quote:
Originally posted by Code

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if (Message.match(Hello)!=null)
{
ChatWnd.SendMessage(hi);
}

also just tried
quote:
Originally posted by Code

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if (Message.match(Hello)!=null)
ChatWnd.SendMessage(hi);
}

Ive done it before i just cant remember exactly how :(
And Plus Live accepted it but it didnt work when my contact said Hello :(

This post was edited on 09-10-2006 at 03:41 PM by Eddie.
...there used to be a signature here :)
09-10-2006 03:38 PM
Profile PM Web Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
RE: [Help] Code
You left out a curly bracket ;)

OK, I see your edit now:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
    if (Message == 'Hello')
    {
        ChatWnd.SendMessage('hi');
    }
}

Edit: Damn MyBB RC2 for not indenting the code :(

This post was edited on 09-10-2006 at 03:45 PM by absorbation.
09-10-2006 03:41 PM
Profile PM Find Quote Report
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. RE: [Help] Code
Whered i forget a curly bracket? :S
...there used to be a signature here :)
09-10-2006 03:41 PM
Profile PM Web Find Quote Report
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. RE: [Help] Code
quote:
Originally posted by absorbation
You left out a curly bracket ;)

OK, I see your edit now:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
    if (Message == 'Hello')
    {
        ChatWnd.SendMessage('hi');
    }
}

Edit: Damn MyBB RC2 for not indenting the code :(

Still didnt send it to my contact :S
...there used to be a signature here :)
09-10-2006 03:48 PM
Profile PM Web Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: [Help] Code
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
    if(Message == 'Hello')
    {
    ChatWnd.SendMessage('Hi')
    }
}

Looks same but this one works [Image: msn_confused.gif].

This post was edited on 09-10-2006 at 04:00 PM by Felu.
09-10-2006 03:58 PM
Profile E-Mail PM Web Find Quote Report
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. RE: [Help] Code
quote:
Originally posted by -!Felu!-
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
    if(Message == 'Hello' && Origin != Messenger.MyName)
    {
    ChatWnd.SendMessage('Hi')
    }
}

Thanks buddy :D that works!
...there used to be a signature here :)
09-10-2006 04:00 PM
Profile PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: [Help] Code
The problems were:
  • Message.match only accepts a regular expression as parameter (e.g.: /Hello/i), where your script had an undefined variable Hello
  • you tried to send an undefined variable hi to the chat window
  • the script would respond on both your and the contacts messages
So, a solution when you really want to use regular expression would be:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
    if(Message.match(/hello/i) && Origin != Messenger.MyName)
    {
        ChatWnd.SendMessage('Hi')
    }
}
But if you don't need regular expressions, you can just keep -!Felu!-'s version. ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-10-2006 04:45 PM
Profile E-Mail PM Web Find Quote Report
vladinator
Junior Member
**

Avatar

Posts: 21
34 / Male / –
Joined: Apr 2003
RE: [Help] Code
Il use this topic to continue my topic from here:
http://www.mpscripts.net/showthread.php?tid=79

Reason I post here is since you already started the begining of the problem, and il just continue it. :)

Now this is the code I managed to make:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{

    //Help text
    if( Message.match(/!help/i) )
    {
        ChatWnd.SendMessage('!help = Show this text. !song = Show the song im listening to. !sendsong = Send you the song im listening to.')
    }

    //Song name
    if( Message.match(/!song/i) )
    {
        ChatWnd.SendMessage('/np')
    }
   
    //Send Song
    if( Message.match(/!sendsong/i) )
    {
        ChatWnd.SendMessage('/sendsong')
    }

}


But there are a few problems.

1) When you !help it spams it alot.
2) If you say !help in the middle of a sentence, it still works.
3) If you use !help and the !help contains !song and !sendsong it registers it and you get a loop of the commands.

Also I would like to know how to make a new line for the help thingy, so I can separate. And simply make it only work if its in the begining of the message and only the command, nothing else behind or before. Thats simply what I need to fix and this code will work like a dream. ^^ (and remove loop /cry)
[Image: banner.gif]
09-25-2006 06:48 PM
Profile E-Mail PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: [Help] Code
quote:
Originally posted by vladinator
1) When you !help it spams it alot.
2) If you say !help in the middle of a sentence, it still works.
3) If you use !help and the !help contains !song and !sendsong it registers it and you get a loop of the commands.

use a regular expression such as:
/^!command$/i

the ^ means the expression should only match strings starting at the beginning of the message
the $ means the same but for the end

or you could just use plain text match such as:
if(Message == '!song')....
but it wouldnt be case insensitive then...
09-25-2006 07:09 PM
Profile PM Find Quote Report
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: [Help] Code
And also check if he send the command or you did...
(That's why it was looping)

Mattike already pointed this out
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
    if(Message.match(/hello/i) && Origin != Messenger.MyName)
    {
        ChatWnd.SendMessage('Hi')
    }
}

This post was edited on 09-25-2006 at 07:21 PM by Shondoit.
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
09-25-2006 07:20 PM
Profile PM 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