Shoutbox

artificial intelligence script(close window) - 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: artificial intelligence script(close window) (/showthread.php?tid=66452)

artificial intelligence script(close window) by xsouldeath on 09-19-2006 at 11:32 PM

#1well ive been making a bot u can add zerounderscore@hotmail.com if u want to try it out or w/e

function OnEvent_ChatWndDestroyed(ChatWnd)
{
ChatWnd.SendMessage("You better not even think about closing the window dude!!");OnEvent_ChatWndDestroyed
The OnEvent_ChatWndDestroyed event is fired when a chat window is destroyed.

Syntax
OnEvent_ChatWndDestroyed(
    [object] ChatWnd
);
Parameters
ChatWnd
[object] Reference to the ChatWnd object attached to the chat generating the event.
Return Value
No value has to be returned by this event.

Remarks
None.

Event Information
Event Source Windows Live Messenger
Availability Messenger Plus! Live 4.00
"

When contact closes window it still works and DOES NOT OPEN A NEW WINDOW!

so i guess this could be impleneted still
BUT i need a way given the current window
ChatWnd to get the contact's email who I am talking to..
that way I could use the open window
function OnEvent_ContactSignin(Email)
{
ChatWnd=Messenger.OpenChat(Email);
ChatWnd.SendMessage("Hi there my best friend.. How u doin today ;)");
}

}


"
#2 What is the escape charaacter
like for example
normally to reply to a user message i use

if(Message.match(/(^|\s+)(\*)?you suck(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage("no you do!");
}

but if the user says like
/nudge
(gives  a nudge)
i can't get it to work because the slash is reserved


lowercase copy is a simple copycat
basically its one "function" that i would be using in my artificial intelligence
since i don't want to ask well in pseudocode
if (message == "hello")
do this
else if (message=="Hello")
do this
..


RE: artificial intelligence script(close window) by cloudhunter on 09-19-2006 at 11:48 PM

First things first. You can't detect when a user has closed your window.

Secondly, to get a nudge event you need to get the information from the protocol. The information isn't sent like "/nudge". Look at cookies nudge protection script or my nudgeback script to see how to detect a nudge.

Cloudy.


RE: artificial intelligence script(close window) by CookieRevised on 09-20-2006 at 12:19 AM

  • #0 I opened the thread looking in full expectation to see something about AI... this has got absolutely nothing todo with AI... :(

  • #1
    1. The ChatWndDestroyed event is fired when a chat window on your side is closed.

    2. You can still send a message from inside this event because this event is triggered right before a chat window of you gets closed/destroyed, not after. So the window is still open at the time this event is executed.

    3. Remember that a chat window can have multiple contacts. So it isn't as easy as "to get the contact's email". You will get the emails of all the contacts which are in the chat window.

    4. To get the emails of the contacts, you need to enumerate a Contacts object to get a Contact object from where you can get the Email property.
      If you look into the Scripting Documentation, you'll see that a ChatWnd object (which you get as a parameter in the ChatWndDestroyed event) will have a property Contacts.
      Thus:

      ChatWnd.Contacts
        > Contact > Contact.Email
        > Contact > Contact.Email
        > Contact > Contact.Email
        > etc...

      in code:
      code:
      var objContactsInWindow = ChatWnd.Contacts;
      for (var e = new Enumerator(objContactsInWindow); !e.atEnd(); e.moveNext()) {
              var objContact = e.item();
              Debug.Trace(objContact.Email);
      }
      or in short:
      code:
      for (var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()) {
              Debug.Trace(e.item().Email);
      }
      note: this is also given as example in the Scripting Documentation.

    5. Because of (A), what you want to do is not possible with the use of the ChatWndDestroyed event.
      To do what you want you need to use 'packet sniffing' and sniff the incomming packets for a closed session notification.

      Because of the nature of these closed session notifications, you can still not do what you want to do as these notifications are also send by the Messenger server itself when a timeout occurs (thus even when the contact did not closed the window).

    6. Before you send a message to a chat window you must always check if you actually can send a message by checking upon the EditChangeAllowed boolean property of the ChatWnd object.
  • #2
    1. I dunno what you exactly mean or want here, but I guess you want to know what is used in JScript as an escape character? it is the slash: \

      eg:
         \n => newline
         \t => tab
         \xCD => character in hexadecimal notation (must be 2 digits)
         \uABCD => unicode character in hexadecimal notation (must be 4 digits)
         \\ => the character \
         \/ => the character / (for use in regular expressions for example)
         etc...

    2. As said by Cloudhunter, a nudge can not be detected by normal means. Again you must revert to 'packet sniffing' for that.


packet sniffing is listening to the raw incomming packets which are send by the servers (and listening to the raw outgoing packets send by your Messenger). You can use Pai's Xniff ActiveX DLL to do this.
RE: artificial intelligence script(close window) by xsouldeath on 09-20-2006 at 12:27 AM

good stuff ppl lol thanx 4 quick reply..well i now tweak messenger avaialble @ mess.be had notification when they closed a window so i thought it was thorugh Messenger Plus or the protocol or w/e..maybe u cant do it anymore

another thing is 1) kicking ppl off msn 2) spying on msn convesrsations
does the mesenger plus allow such actions, because i know someone who has spied on my windows msesenger live convesraitons not sure what he used but he knew exactly who i was tlaking to and he doesnt know the guy


RE: artificial intelligence script(close window) by Spunky on 09-20-2006 at 12:30 AM

You can search for forums to answer most of your questions you know...

Kicking people off msn... I'm guessing you mean group chats. Like I said, search. There are numerous threads that explain this.

As for spying on another persons  conversation... It isn't/shouldn't be possible because of privacy. However your friend did it, it was most likely not done with Messenger Plus

EDIT:

quote:
Originally posted by CookieRevised
#0 I opened the thread looking in full expectation to see something about AI... this has got absolutely nothing todo with AI...
So did I...
RE: artificial intelligence script(close window) by CookieRevised on 09-20-2006 at 12:34 AM

quote:
Originally posted by xsouldeath
good stuff ppl lol thanx 4 quick reply..well i now tweak messenger avaialble @ mess.be had notification when they closed a window so i thought it was thorugh Messenger Plus or the protocol or w/e..maybe u cant do it anymore
You can still 'do it' and it will be in exactly the same way as the other tools do it: by packet sniffing (the protocol). But as said it is not a closed window notification, it is a closed session notification and it can be triggered by the server itself in many other occasions than simply the contact closing the chat window. So it is not accurate at all...

quote:
Originally posted by xsouldeath
another thing is 1) kicking ppl off msn 2) spying on msn convesrsations
does the mesenger plus allow such actions, because i know someone who has spied on my windows msesenger live convesraitons not sure what he used but he knew exactly who i was tlaking to and he doesnt know the guy
1) you can not kick people off (anymore; it was previously possible due to a bug in Messenger)
2) spying:
a) you will not get any help on this as it is considered illegal and immoral and therefore not allowed.
b) it is even not possible unless the contact you want to spy on and which is on another network, runs a script/trojan/whatever on his own computer which sends everything back to you.
RE: artificial intelligence script(close window) by Lou on 09-20-2006 at 12:36 AM

quote:
Originally posted by xsouldeath
1) kicking ppl off msn 2) spying on msn convesrsations
Even if this was remotely possible (which it isn't) Patchou wouldn't support it. It's privacy invasion. Illegal and stupid.
RE: artificial intelligence script(close window) by xsouldeath on 09-20-2006 at 01:39 AM

okay adding any two numbers(reasnoable numbers)..
like if they say 1 + 1 my program should say 2

if (Message.match(/(^|\s+)(\*)?add(d|s)?(\*)?($|\s+)/i)!=null)
{
//i was trying to find the frikken equal sign lol ..but
var plus =Message.indexOf("+");
var value1= Message.substring(0,plus)
var value2=Message.substring(plus+1,Message.length()-1)
}

okay how does the Message.match function work
because I have
if(Message.match(/(^|\s+)(\*)?1+1?(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage("duh its 2 u moron");
}
if(Message.match(/(^|\s+)(\*)?2+2?(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage("duh its 4 u moron");
}
if(Message.match(/(^|\s+)(\*)?2+5?(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage("duh its 7 u moron");
}

but when someone says add 2 + 2
it says:
"duh its 2 u moron
duh its 7 u moron"

in other words both if statements are triggered..how do i make it match exactly or properly..


and i fixed the adding thingy up a bit but still doens't add properly.
===================
if (Message.match(/(^|\s+)(\*)?add(d|s)?(\*)?($|\s+)/i)!=null)
{
var plus =Message.indexOf("+");
var value1= Message.substring(0,plus);
var value2=Message.substring(plus+1,Message.length()-1);
var final=value1+value2;
ChatWnd.SendMessage(""+final);
}


RE: artificial intelligence script(close window) by CookieRevised on 09-20-2006 at 01:51 AM

I don't want to sound too negative, but I'd suggest to read up on some tutorials about scripting actually....

search google for JScript tutorials which explain basic scripting...

And a JScript help file can be found here which explains all the functions, methods and properties, etc in details.
(especially look up how regular expressions work and what the correct syntaxis are, as the ones you posted don't make any sense; and it is way too much to explain everything; especially if everything can already be read on the web and in the help file)


For info regarding Plus! functions and methods, see here.


RE: artificial intelligence script(close window) by xsouldeath on 09-20-2006 at 02:07 AM

well i try to look up the Message.match
if (Message.match(/(add)/i))
{
Message=Message.trim();
ChatWnd.SendMessage(Message);
var plus =Message.indexOf("+");
var value1= Message.substring(0,plus);
var value2=Message.substring(plus+1,Message.length()-1);
var final=value1+value2;
ChatWnd.SendMessage(""+final);
}

i guess my program crashes there..


RE: artificial intelligence script(close window) by CookieRevised on 09-20-2006 at 02:13 AM

I am not going to start explaning everything you do wrong there (which is a lot), sorry... please see the links I posted.....

They give the full detailed and extensive help which you need regarding regular expressions, and scripting in general (as you don't even need to do what you do to get the sum of those two numbers).

Explaning everything in detail on the forum would be too extensive and it also would simply end up in being a copy of what is explained in the help files (links provided in previous post).

sorry


RE: artificial intelligence script(close window) by xsouldeath on 09-20-2006 at 03:13 AM

fixed script
if (Message.match(/(^|\s+)(\*)?add(d|s)?(\*)?($|\s+)/i)!=null)
{
Message=Message.substring(3);
ChatWnd.SendMessage("attempting to add now..");
ChatWnd.SendMessage("Message is now"+Message);
var anExpression = Message;
var total = eval(anExpression); // Assigns the value 5 to the variable total.
ChatWnd.SendMessage(total.toString());
}
extensive and n00by bot script...


current bot commands:
google dog                ....
image dog             ....(google images)
huh                       ...(disses you up)
add mathetmatical operation
ex:
add 7 * 8 + 1      ...==>gives 57






RE: artificial intelligence script(close window) by xsouldeath on 09-20-2006 at 11:59 PM

gulp.. spot the error in this huge program
its most likely an escape character '\'
or  Message.match wrong syntax

coz it was working fine then i tried to comment stuff out with // and when i put un commented it the code died..


RE: artificial intelligence script(close window) by CookieRevised on 09-21-2006 at 09:38 AM

1) try to update previous posts when you update your script. It is of no use to have 65416451 attachments in an equal amount of posts. Its very confusing that way.

2) Have you followed the suggestions (learning about how regular expressions work, basic scripting, etc)? It seems not though as your script still contains the same errors, bad programming and stuff.


RE: artificial intelligence script(close window) by xsouldeath on 09-21-2006 at 12:59 PM

bad programming im sure the script contains that, but it works
you didn't really mention about the bad programming.... lol the script works and some say its better than smarterchild .. so yay :)


RE: artificial intelligence script(close window) by Matti on 09-21-2006 at 03:19 PM

quote:
Originally posted by xsouldeath
bad programming im sure the script contains that, but it works
you didn't really mention about the bad programming.... lol the script works and some say its better than smarterchild .. so yay :)
It's not about if it works, it's about if it works good. When you release a script which contains crappy, unneeded stuff like:
code:
if (Message.match(/(^|\s+)(\*)?add(d|s)?(\*)?($|\s+)/i)!=null)
or:
code:
var anExpression = Message;
others will be confused about it and think that they have to use the same in their scripts. Then, when it doesn't work, they come here and ask why. And we don't want thar, huh? :)

A good example of bad programming is:
code:
if (Message.match(/(^|\s+)(\*)?add(d|s)?(\*)?($|\s+)/i)!=null)
This rule contains so much unneeded stuff that it could even match a string like:
quote:
Hey I thought he     *adds*  something like bananas
If you would study the regular expression and know how to write proper regexp, you'll know why. Also, this code will make your script fail or even crash since it'll try to send:
quote:
I thought he     *adds*  something like bananas
to the eval function. :-/
So: go to some tutorial site like this one and learn proper regular expressions. ;)
RE: artificial intelligence script(close window) by xsouldeath on 09-21-2006 at 07:31 PM

current glitch in bot:
when someone comes online it messages them twice instead of once..
Possible solution: add come online script to status of online instead of come online.

regexp  (WHAT IS THAT!!!???) ....
well the Message.Match i copied and pasted like 200 times
i still don't know all that it does, when i looked it up i saw something about replacing the first word with the second word...
=====================================

the script doesnt fail or crash so far ... it does occasionally trigger numerous statements that should not be what i want... but as far as adding its fine .. i guess i shouldve used the  "math" string instead. as far as Message.math i have no idea what it means

I will consider your suggetsions and check out the site

some more ideas to make the bot "fun" would be great for this as well..

well i checked the site sent but how do i make the message.match
match ONLY an exact message they type in
like "hi."
then it says "sup"

and then "hi. how are you"
says "im good"

anyways the bot has a basic word scrambler game
just type "game"
===================================
okay well anyways heres attached a java tutorial for you people...
it cludes the one available from downloads section here
as well as the matching characters and other stuff from it
My bot was able to:(well the basis of this bot was the Hey you sample program or whatever)


(anything suggestions to make the bot more fun are appreciated ... if you want to try the bot out add (again...) zerounderscore@hotmail.com):
1) message contacts when they come online
2) message contacts when they change their status
3) message contacts when they change their nickname
4) (prevent users from being messaged from the above) ==>well assuming they don't message you :P
5) play a word scramble game

ex: descramble the word lehlo
(the user types "hello")
the bot says next level ....
gives scrambled word...

6) respond to its own messages(pretty dumb..) [this you just modify the if (Origin != Messenger.MyName)

7) copycat other users(say what they say back to you))
8) give google links to search term when the user types for example:
google dog+hair
link to google for the search term "dog hair"
9) give google image links
ex: "image dog+hair"  give users link to google images with serach term dog hair
10) the bot makes comebacks to disses and responds to common phrases, it has a commands list when you type "commands"