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

Need help with a script
Author: Message:
kantom
New Member
*


Posts: 1
Joined: May 2007
O.P. Huh?  Need help with a script
I cant work out why the following scrip doesnt work:

code:
var on = '0'

function OnEvent_ContactSignin(sEmail)
{
Messenger.OpenChat(sEmail);
on = '1'
}

function OnEvent_ChatWndCreated(ChatWnd)
{
if (on == '1')
{
on = '0'
ChatWnd.SendMessage("Hello (!N) !");
}
}


Its meant to open a chat box with someone as soon as they login and then say Hello.
05-08-2007 06:26 AM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: Need help with a script
This should work (untested though):

code:
function OnEvent_ContactSignin(sEmail){
   var ChatWnd = Messenger.OpenChat(sEmail);
   ChatWnd.SendMessage("Hello (!N) !");
}


Lines of code should end with a semicolon (I think it's needed)
You were using a string as a boolean, which is possible, but not a good way of doing things.
Also, it shouldn't need to events... A ChatWnd object should be created and returned by the OpenChat function

Look in the scripting documentation for more help

This post was edited on 05-08-2007 at 02:52 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
05-08-2007 02:42 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Need help with a script
Made even smaller:

code:
function OnEvent_ContactSignin(_email){
   Messenger.OpenChat(_email).SendMessage("Hello (!N) !");
}
05-08-2007 05:10 PM
Profile E-Mail PM Find Quote Report
pray2win
Junior Member
**


Posts: 40
Joined: Feb 2008
RE: Need help with a script
This i want. but then on a certain e-mail adress. :|
Like only for a certain friend ;)

Because i use Answering machine plus and i did
that if they type a code my name changes into
[Jef] Current Online admin: (they're name here)

but i wantthat on sign in of the admins
so when Arrie (one of my admins sign in)
it should say /name [Jef] Current Online admin: Arrie
05-12-2008 06:19 PM
Profile E-Mail PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
29 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Need help with a script
quote:
Originally posted by pray2win
This i want. but then on a certain e-mail adress. :|
Like only for a certain friend ;)

Because i use Answering machine plus and i did
that if they type a code my name changes into
[Jef] Current Online admin: (they're name here)

but i wantthat on sign in of the admins
so when Arrie (one of my admins sign in)
it should say /name [Jef] Current Online admin: Arrie

try this then:

code:
function OnEvent_ContactSignin(Email){
if(Email == "someone@somewhere.com") Messenger.OpenChat(Email).SendMessage("/nick [Jef] Current Online admin: (!N)");
}


but if you want to do it without opening a conversation window,
code:
function OnEvent_ContactSignin(Email){
if(Email == "someone@somewhere.com") Messenger.MyName = "[Jef] Current Online admin: " + Messenger.MyContacts.GetContact(Email).Name;
}

This post was edited on 05-12-2008 at 07:30 PM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
05-12-2008 07:27 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Need help with a script
Some important remarks about stuff like:
code:
Messenger.OpenChat(Email).SendMessage("something");
Better never use that.

Before sending a message you should always check if you actually can send a message (and if that conversation window can actually be opened). It is quite possible that you can't even send something because you've blocked the contact, or because the window can't be opened, or the contact has a mobile phone and you need to sign up first for credits, or whatever...

So:
code:
var oChatWnd = Messenger.OpenChat(Email);
if (oChatWnd.EditChangeAllowed) {
     oChatWnd.SendMessage("something")
}

This important check is way too often forgotten in extremely many scripts.

See Plus! Scripting Documentation. This is also explained in the help of the SendMessage() function...

;)

This post was edited on 05-12-2008 at 07:40 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-12-2008 07:39 PM
Profile PM Find Quote Report
pray2win
Junior Member
**


Posts: 40
Joined: Feb 2008
RE: RE: Need help with a script
quote:
Originally posted by roflmao456
quote:
Originally posted by pray2win
This i want. but then on a certain e-mail adress. :|
Like only for a certain friend ;)

Because i use Answering machine plus and i did
that if they type a code my name changes into
[Jef] Current Online admin: (they're name here)

but i wantthat on sign in of the admins
so when Arrie (one of my admins sign in)
it should say /name [Jef] Current Online admin: Arrie

try this then:

code:
function OnEvent_ContactSignin(Email){
if(Email == "someone@somewhere.com") Messenger.OpenChat(Email).SendMessage("/nick [Jef] Current Online admin: (!N)");
}


but if you want to do it without opening a conversation window,
code:
function OnEvent_ContactSignin(Email){
if(Email == "someone@somewhere.com") Messenger.MyName = "[Jef] Current Online admin: " + Messenger.MyContacts.GetContact(Email).Name;
}


Yes i've seen this while search
but i can't have this worked.
Add new i can ;)
But strange it doesnt work :|
(tested with signing my other e-mail in)
05-12-2008 07:43 PM
Profile E-Mail 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