correction please - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: correction please (/showthread.php?tid=67030)
correction please by DennisMartijn on 10-06-2006 at 05:52 PM
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 )
btw im a bit ill, headache etc, so i dont reply till t'm'rr'w.
RE: correction please by Felu on 10-06-2006 at 06:08 PM
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?
RE: correction please by Ezra on 10-06-2006 at 06:15 PM
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;
}
}
RE: correction please by matty on 10-06-2006 at 06:17 PM
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è!");
}
}
}
RE: correction please by DennisMartijn on 10-24-2006 at 12:25 PM
that code does work... in a wrong way
*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).
RE: correction please by Plan-1130 on 10-24-2006 at 12:51 PM
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{}.
RE: correction please by markee on 10-24-2006 at 03:41 PM
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).
RE: correction please by phalanxii on 10-25-2006 at 07:01 AM
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.
PS. Don't take this as a personal attack or anything, markee. Just wanted to improve your coding skills.
RE: correction please by DennisMartijn on 10-25-2006 at 07:40 AM
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) ?
RE: correction please by phalanxii on 10-25-2006 at 08:01 AM
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.
RE: correction please by DennisMartijn on 10-25-2006 at 08:05 AM
oke thanks;P
I couldnt just come up to something like i = etc seems like the script documentation S888s a little
RE: correction please by phalanxii on 10-25-2006 at 08:10 AM
Heh, well the scripting documentation doesn't really explain the scripting language, but rather the Messenger Plus! functions and properties.
If you want a better explanation of the commands in JScript, try using the MSDN Library.
RE: correction please by DennisMartijn on 10-25-2006 at 08:11 AM
*saves this in favorites*
RE: correction please by markee on 10-25-2006 at 08:27 AM
Or if you would prefer a copy on your computer (well at least for a lot of the basics) try downloading Windows Script 5.6 Documentation and for some tips and tricks with the Messenger Plus stuff, have a look at PlusScriptWiki.
And sorry about the bad advice with the script, it has been a while since I last worked on a script and I was a little tired.
|