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

Pages: (2): « First [ 1 ] 2 » Last »
correction please
Author: Message:
DennisMartijn
Full Member
***


Posts: 119
Joined: Jul 2006
O.P. correction please
code:
function OnEvent_ChatWndSendMessage(     
   if (Message == "irritant Hè!"){
    SendMessage(Message == "irritant Hè!") = true
    SendMessage(Message == "irritant Hè!") = true
    SendMessage(Message == "irritant Hè!") = true
    SendMessage(Message == "irritant Hè!") = true
    SendMessage(Message == "irritant Hè!") = true
    SendMessage(Message == "irritant Hè!") = true
    }

);


i made this code so far, but i dont know how to specifie wich person (email adress) your talking to. so, i only want this script to work and send multiple messages "irritant Hè!" to on person, if you send the message "irritant Hè!" without the "" to him. i want to specifie the person by his email adres                       

i wanted to make this script becuz a good friend of mine has something like this to but doesnt want to tell what the code is (i hate him :P)

btw im a bit ill, headache etc, so i dont reply till t'm'rr'w.
10-06-2006 05:52 PM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: correction please
code:
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext())
Contact = e.item();
if("name@domain.com" == Contact.Email){
ChatWnd.SendMessage("irritant Hè!");
}
If that what you want to do?
10-06-2006 06:08 PM
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: correction please
That code is a mess, and it won't work at all.

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if (Message == "!irritant")
  {
    if (ChatWnd.EditChangeAllowed)
    {
      for (var i = 0; i< 10; i++)
      {
        ChatWnd.SendMessage("irritant Hè!");
        return "irritant Hè!";
      }
    }
  }
  else
  {
    return Message;
  }
}
[Image: 1-0.png]
             
10-06-2006 06:15 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: correction please
Or simplified down to:

code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessag){
    for(var e = new Enumerator(pChatWnd.Contacts); !e.atEnd(); e.moveNext())
        if("name@domain.com" == e.item().Email){
            pChatWnd.SendMessage("irritant Hè!");
        }
    }
}

10-06-2006 06:17 PM
Profile E-Mail PM Find Quote Report
DennisMartijn
Full Member
***


Posts: 119
Joined: Jul 2006
O.P. RE: correction please
that code does work... in a wrong way:P

*removed the line 'if / .Email) {*
code still works. so it works for every contact now... if i send a message, my contact recieves it, but with tons of "irritant Hè!". i wanted that, but only when i say "irritant Hè!" (without ""). now its spams my contact by everything i say...

this is how the script has to work:

1*i send the message "irritant Hè!" (without "");  (!!!(so it works only when i say THAT!!!))
2*the script repeats that message with a randomly number (what it already does).


:P

This post was edited on 10-24-2006 at 12:27 PM by DennisMartijn.
10-24-2006 12:25 PM
Profile E-Mail PM Find Quote Report
Plan-1130
Full Member
***

I keep askin' myself: why?

Posts: 142
73 / Male / –
Joined: Feb 2005
RE: correction please
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if (Message == "irritant Hè!")
  {
     for (var i = 0; i< 14; i++)
     {
       ChatWnd.SendMessage("irritant Hè!");
       return "irritant Hè!";
     }
  }
  else
  {
    return Message;
  }
}

slightly edited code from Ezra, this should work, it sends "irritant Hè!" 15 times when you say it once. I'm too lazy to make it a random number of times.
And btw ChatWnd.EditChangeAllowed is always true when the code is executed because it has to be in order to execute it, and SendMessage fails if it's false, so checking it is as far as i know a bit useless if you don't use else{}.

This post was edited on 10-24-2006 at 12:55 PM by Plan-1130.
My Scripts: UltimatFlooder, Advanced PSM Chat, PlusPrivacy, PlusRemote

[Image: Plan-1130.png]
10-24-2006 12:51 PM
Profile E-Mail PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: correction please
code:

var i=0;
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
  if (Message == "irritant Hè!" && i<15){
       ChatWnd.SendMessage(Message);
       i++;
     }
  }else{
    i=0;
    return "";
  }
}
Just an adaption of Plan-1130's code except a simpler version imo (I didn't test it but I don't think his code works).  The only real problem with my code is that if you send this to another person before the 15 messages are sent then there are some problems (though this should only occur if you use an /all command with your message).
[Image: markee.png]
10-24-2006 03:41 PM
Profile PM Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: correction please
I don't want to sound critical or anything, but I personally think Plan-1130's code is slightly better than markee's. *-)

First of all, in markee's code, i does not need to be a global variable (defined outside the function), because it is only used by that one function. The fact that it is a global variable in the code is the reason why there are conflicts when "you send this to another person before the 15 messages are sent". Using the for statements in Plan-1130's code is in my opinion a cleaner and better way to spam the message because, not only is i then a local variable, but statements such as if(i<15), i++ and i=0 are implied in the one line.

Secondly, in markee's code, if Message does not equal "irritant Hè!", then the else statements are executed, including return "". I haven't tested this, but this should mean that all other messages are not sent to the user's contact.

The only problem I find in Plan-1130's code is that return Message may interfere with other scripts, but this is fairly minor and probably won't happen.

That's basically why I would go for Plan-1130's code instead of markee's. (Y)

PS. Don't take this as a personal attack or anything, markee. Just wanted to improve your coding skills. :)
10-25-2006 07:01 AM
Profile PM Find Quote Report
DennisMartijn
Full Member
***


Posts: 119
Joined: Jul 2006
O.P. RE: correction please
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if (Message == "irritant Hè!")
  {
     for (var i = 0; i< 14; i++)
     {
       ChatWnd.SendMessage("irritant Hè!");
       return "irritant Hè!";
     }
  }
  else
  {
    return Message;
  }
}


what will happen if you leave out "for (var etc", like this:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if (Message == "irritant Hè!")
  {
            ChatWnd.SendMessage("irritant Hè!");
       return "irritant Hè!";
     
  }
  else
  {
    return Message;
  }
}


then its sending the message one time right?

code:
if (Message == "irritant Hè!")
  {
            ChatWnd.SendMessage("irritant Hè!");
       return "irritant Hè!";
     ChatWnd.SendMessage("irritant Hè!");
       return "irritant Hè!";

  }


does this works too? does it sends 2 messages now (dont have someone to test on:P) ?
10-25-2006 07:40 AM
Profile E-Mail PM Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: correction please
Not quite, you see, once the return statement is parsed, your function stops running. So basically, you will want to edit Plan-1130's code. This is my version with a few fixes:
code:
var Status = false;

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
   if(Message == "irritant Hè!" && !Status) {
       Status = true;
       for(var i = 0; i < 5; i++) ChatWnd.SendMessage("irritant Hè!");
       Status = false;
       return "";
   }
   else return Message;
}
My coding is not excellent (and I haven't tested this) so you may want to be careful. I just realised that ChatWnd.SendMessage will also call the function again, so the script will loop! That's why I added Status to make sure it doesn't recall it. If you make your command different, then it will be a lot easier:
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
   if(Message == "!irritant") {
       for(var i = 0; i < 5; i++) ChatWnd.SendMessage("irritant Hè!");
       return "";
   }
   else return Message;
}
In the above script, you will need to type "!irritant" to activate your messages.

To change the amount of messages in the function, change the number in red to the number you want.

If anyone wants to improve on this script, be my guest.

This post was edited on 10-25-2006 at 08:03 AM by phalanxii.
10-25-2006 08:01 AM
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