What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] Alert on specific message

Pages: (3): « First [ 1 ] 2 3 » Last »
[Request] Alert on specific message
Author: Message:
glargle
New Member
*


Posts: 11
Joined: Jul 2007
O.P. [Request] Alert on specific message
I have no knowledge  of scripting, so all my attempts have failed.

I'm looking for a script, that when a specific word is received in a message, a sound will play. I have all sounds turned off in WLM so I want a sound to be played on certain occasions.

I'm sure this is a fairly simple script so can anybody help?
07-17-2007 11:51 PM
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: [Request] Alert on specific message
:banana:Welcome to the forum!:banana:
code:
var word = new Array(
"your",
"words",
"here"
);

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind){
if(Origin != Messenger.MyName){
for(i=0;i<word.length;i++){
if(Message.search(word[i]) != -1){
MsgPlus.PlaySound("path\\to\\sound\\file");
}
}
}
}

i'm not sure if that will work but you can try.

btw, for a single backslash ( \ ) you have to put two. so

\\

will result in a single backslash ;)

This post was edited on 07-18-2007 at 12:28 AM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
07-18-2007 12:25 AM
Profile PM Web Find Quote Report
glargle
New Member
*


Posts: 11
Joined: Jul 2007
O.P. RE: [Request] Alert on specific message
Thanks alot man, but it doesn't work :(

All I need to edit is the path to the audio file, right? I've tried .wav and .mp3 with the double \
07-18-2007 12:44 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: [Request] Alert on specific message
could you get the text from the debug window?

(make sure the checkbox (debugging options) is checked in the scripts preferences)

This post was edited on 07-18-2007 at 01:33 AM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
07-18-2007 01:32 AM
Profile PM Web Find Quote Report
glargle
New Member
*


Posts: 11
Joined: Jul 2007
O.P. RE: [Request] Alert on specific message
Script has been stopped
Script is starting
Script is now loaded and ready

:\
07-18-2007 01:45 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: [Request] Alert on specific message
quote:
Originally posted by glargle
Script has been stopped
Script is starting
Script is now loaded and ready

:\

when you receive a message lol :P
[quote]
Ultimatess6
: What a noob mod
07-18-2007 02:30 AM
Profile PM Web Find Quote Report
glargle
New Member
*


Posts: 11
Joined: Jul 2007
O.P. RE: [Request] Alert on specific message
Function called: OnEvent_ChatWndReceiveMessage
07-18-2007 03:10 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: [Request] Alert on specific message
quote:
Originally posted by glargle
Function called: OnEvent_ChatWndReceiveMessage
nothing after?
[quote]
Ultimatess6
: What a noob mod
07-18-2007 03:42 AM
Profile PM Web Find Quote Report
glargle
New Member
*


Posts: 11
Joined: Jul 2007
O.P. RE: [Request] Alert on specific message
Nope. I get that message everytime I send or receive a message.
07-18-2007 04:33 AM
Profile E-Mail PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [Request] Alert on specific message
quote:
Originally posted by roflmao456
:banana:Welcome to the forum!:banana:
code:
var word = new Array(
"your",
"words",
"here"
);

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind){
if(Origin != Messenger.MyName){
for(i=0;i<word.length;i++){
if(Message.search(word[i]) != -1){
MsgPlus.PlaySound("path\\to\\sound\\file");
}
}
}
}

i'm not sure if that will work but you can try.

btw, for a single backslash ( \ ) you have to put two. so

\\

will result in a single backslash ;)
Your code can be made a little better, the use of a regular expression means that you only have to make the one if statement rather than 2 and the for statement.  Also you might want to look at using things other than a search method because it doesn't give much that you can work with after (I know there was nothing in this case but it can be useful later and a good habit to get into).
code:
var word = new Array(
"your",
"words",
"here"
);
var re = RegExp("\b"+word.join("\b|\b")+"\b","i");

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind){
if(Origin != Messenger.MyName && re.test(Message)){
MsgPlus.PlaySound("path\\to\\sound\\file");
}
}

This code does exactly the same as roflmao456's code anyway, I think the problem might be in the path that you are making.  Please make sure that you use the \\ and that you start from the drive letter and double check that the file exists where you are looking.

If that doesn't work then please try this code:
code:
MsgPlus.PlaySound("path\\to\\sound\\file");
This is just to make sure that the sound file is work and that you have the right path to it.  It should make the sound when you save the script.  I advise you to get rid of this once it has worked or else every time you start messenger then you will hear the sound.

If you keep having troubles can you please copy and paste the path that you are using to the file so that we can just double check you are doing it correctly and also make sure that you have your sound on (you'd be amazed at how many people don't think of the little things).
[Image: markee.png]
07-18-2007 04:45 AM
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