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

Help with script...
Author: Message:
GrimReapa
New Member
*

Avatar

Posts: 2
Joined: Jun 2006
O.P. Help with script...
I'm trying to make a simple script (for my first time) that will show how many times I have recieved a message with "Nick" in it... but at the moment I only know how to get it to check if the whole message is Nick...
How would i change it so that if any part of the message contained "Nick" then it would update the count?

Current Code:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Sender, ChatMsg, ChatType)
{
    if (ChatMsg == "Nick") {
    Nick = Nick + 1;
    Debug.Trace("Added one to count.");
    ChatWnd.SendMessage("The Nick Count is now at: " + Nick);
    }
    if (ChatMsg == "nick") {
    Nick = Nick + 1;
    Debug.Trace("Added one to count.");
    ChatWnd.SendMessage("The Nick Count is now at: " + Nick);
    }
}
06-25-2006 10:11 AM
Profile E-Mail PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
RE: Help with script...
Why the two if statements? Try elseif for the second :P

Edit: Where have you defined your Nick varible?
Edit 2: Woops I am talking some bull. *wakes up*

This post was edited on 06-25-2006 at 10:16 AM by absorbation.
06-25-2006 10:12 AM
Profile PM Find Quote Report
alexp2_ad
Scripting Contest Winner
****

Avatar
Who love the chocolate?

Posts: 691
Reputation: 26
36 / Male / –
Joined: May 2004
Status: Away
RE: Help with script...
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Sender, ChatMsg, ChatType)
{
if (ChatMsg.toLowerCase().indexOf("nick") > -1) {
Nick = Nick + 1;
Debug.Trace("Added one to count.");
ChatWnd.SendMessage("The Nick Count is now at: " + Nick);
}
}



And that checks for any case as well.

BTW, if you just store it as a variable then the "nick count" will be lost whenver the plugin is stopped, I recommend saving to a file or the registry on uninitialize then loading on initialize. ;)

This post was edited on 06-25-2006 at 10:18 AM by alexp2_ad.
06-25-2006 10:14 AM
Profile E-Mail PM Find Quote Report
GrimReapa
New Member
*

Avatar

Posts: 2
Joined: Jun 2006
O.P. RE: Help with script...
Thanks for your help! works great, just had to take "Nick" out of the message, because it kept repeating :P
06-25-2006 10:17 AM
Profile E-Mail PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Help with script...
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Sender, ChatMsg, ChatType)
{
   if(ChatMsg.search(/nick/i) > -1){
        Nick = Nick + 1;
        Debug.Trace("Added one to count.");
        ChatWnd.SendMessage("The Nick Count is now at: " + Nick);
    }
}

edit: meh im slow

This post was edited on 06-25-2006 at 10:18 AM by Eljay.
06-25-2006 10:17 AM
Profile PM Find Quote Report
ThunderStorm
Junior Member
**

Avatar
I Love Zillah

Posts: 34
37 / Male / –
Joined: Mar 2006
RE: Help with script...
how work that script?
Is there a command for in that script?
Vote On Me
06-25-2006 10:28 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: Help with script...
[OFF TOPIC]

quote:
Originally posted by ThunderStorm
how work that script?
Is there a command for in that script?

The shown source code is part of a script, it is most likely not the complete script.

Also, if you look carefully you see that this function is actually an event:
function OnEvent_ChatWndReceiveMessage(...).

An event is triggered and executed automatically when certain things take place. In this case the event will trigger whenever a message is recieved and thus the function gets executed.

To know how scripts work read the official script documentation.

[/OFF TOPIC]

This post was edited on 06-25-2006 at 11:57 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
06-25-2006 11:56 AM
Profile PM Find Quote Report
« 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