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

Pages: (2): « First [ 1 ] 2 » Last »
Automated reply problem
Author: Message:
le-foot
New Member
*


Posts: 9
Joined: Apr 2008
O.P. Automated reply problem
Hello,

I'm trying to write a script that sends some message back once a message has been sent. However, this


function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
    var Message = "Testing";
    ChatWnd.Sendmessage(Message);

}

seems to make it go in a continuous loop.

If it helps, how do I make use of parameters in OnEvent_ChatWndReceiveMessage?

Thanks
04-24-2008 02:59 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: Automated reply problem
This is going into an infinite loop because OnEvent_ChatWndReceiveMessage is called when you send a message too! What you will want to do is compare the Origin parameter to your current display name. That will tell you if you are sending the message, or if its coming from your contact. One word of caution is that there are addons that can set a chat-only name (like StuffPlug) so you will also have to compare the chat only name as it is stored in the registry if you plan on using that feature any time in the future.

more info:
CookieRevised's reply to [Fix] Problem with OnEvent_ChatWndRecieveMessage's Origin
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
04-24-2008 03:13 PM
Profile PM Web Find Quote Report
le-foot
New Member
*


Posts: 9
Joined: Apr 2008
O.P. RE: Automated reply problem
Thanks for the reply. I see that is a problem, however I'm not familiar with using parameters. Could you give me an example, or point me to an example, of how a parameter is used in this case?

Thanks

EDIT: I'm trying to compare the names now, do you know what is the symbol for "does not equal"? In PHP it's "<>" but it gives me an syntax error.

This post was edited on 04-24-2008 at 03:22 PM by le-foot.
04-24-2008 03:15 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: Automated reply problem
I'm not quite sure what you mean by that... ?

ChatWnd is an object to reference the chat window itself
Origin is a string containing the display name of the suer sending the message
Message, is obvious I home
MessageKind is a numeric value From the scripting docs:
quote:
MSGKIND_UNKNOWN (0) - Unknown
MSGKIND_SAYS (1) -  Text message typed by the user
MSGKIND_WINKS (2) - A wink being sent
MSGKIND_VOICECLIPS (3) - A voice clip being sent
MSGKIND_SEARCHING (4) - A search made with the "Search" button
MSGKIND_FIND (5) - The result of a search made with "Search"
MSGKIND_SAYSOFFLINE (6) - A text message sent while the current user was offline
I would recommend using the numeric constants instead of the associated names.

I recommend you read a bit more thoroughly through the documentation for OnEvent_ChatWndReceiveMessage

This post was edited on 04-24-2008 at 03:23 PM by MeEtc.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
04-24-2008 03:21 PM
Profile PM Web Find Quote Report
le-foot
New Member
*


Posts: 9
Joined: Apr 2008
O.P. RE: Automated reply problem
Yup sorry never mind.

Anyways in the previous post I added - how do I express "does not equal"? If I use "<>" I get syntax error.

Thanks
04-24-2008 03:23 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: Automated reply problem
not equal is !=
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
04-24-2008 03:26 PM
Profile PM Web Find Quote Report
le-foot
New Member
*


Posts: 9
Joined: Apr 2008
O.P. RE: Automated reply problem
Ok so I try this:

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
    if(Origin != Messenger.MyName)
    {
    var Message = "Testing";
    ChatWnd.Sendmessage(Message);
    }
}

But it doesn't seem to go into the if statement. Where has my logic wrong?
04-25-2008 02:29 AM
Profile E-Mail PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Automated reply problem
i think functions are case-sensitive so here's the fixed code

Sendmessage has to be SendMessage.

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
if(Origin != Messenger.MyName){
var Message = "Testing";
ChatWnd.SendMessage(Message);
}
}

the code should work, only when a contact sends you a message :P

This post was edited on 04-25-2008 at 02:39 AM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
04-25-2008 02:38 AM
Profile PM Web Find Quote Report
le-foot
New Member
*


Posts: 9
Joined: Apr 2008
O.P. RE: Automated reply problem
>_<

It pays to activate the script

:$:$:$

(H)

This post was edited on 04-25-2008 at 07:44 AM by le-foot.
04-25-2008 05:45 AM
Profile E-Mail PM Find Quote Report
le-foot
New Member
*


Posts: 9
Joined: Apr 2008
O.P. RE: Automated reply problem
function OnEvent_ContactSignin(Email){
   
       
    var Message = "Hey";
    {______}.SendMessage(Message);
       
}

Okay, instead of when someone says something, I automatically say something when someone signs in.

Now do I put something in the {_____}?

Thanks
04-25-2008 09:06 AM
Profile E-Mail 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