Shoutbox

status script - 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: status script (/showthread.php?tid=95607)

status script by puortant on 10-15-2010 at 02:31 AM

hi there


I want script to do thaht
Change my status  to  busy
When I open a conversation



thanks


RE: status script by Spunky on 10-15-2010 at 09:15 AM

Javascript code:
var old_status = "";
 
function OnEvent_ChatWndCreated(){
  if(Messenger.CurrentChats.Count > 0){
    if(old_status === "") old_status = Messenger.MyStatus;
    Messenger.MyStatus = STATUS_BUSY;
  }
}
 
function OnEvent_ChatWndDestroyed(){
  if(Messenger.CurrentChats.Count === 0){
    Messenger.MyStatus = old_status
    old_status = "";
  }
}


Untested, but should work from what I can tell.
RE: status script by matty on 10-15-2010 at 11:16 AM

Spunky what is ChatWnds.count? (Note I am pointing out that it doesn't exist :P)


RE: status script by foaly on 10-15-2010 at 11:22 AM

quote:
Originally posted by scripting docs
ChatWnds::Count
The ChatWnds::Count property returns the count of ChatWnds contained by this object.

Syntax
This is a read-only property.
[number] Count;
Data Type
A number with a minimum value of 0.

Remarks
The count should not be stored for later use and always requested from the object when needed.

Property Information
Object ChatWnds
Availability Messenger Plus! Live 4.00


So it should be ChatWnds.Count ?
RE: status script by matty on 10-15-2010 at 11:23 AM

Yes but ChatWnds is not declared. It is

Javascript code:
Messenger.CurrentChats.Count;


RE: status script by Spunky on 10-15-2010 at 11:25 AM

quote:
Originally posted by matty
Yes but ChatWnds is not declared. It is
Javascript code:
Messenger.CurrentChats.Count;



I thought it looked a bit wrong when I did it, but looking in the contacts section of the help file (it's been a while) gave me contacts.count. Maybe it should be explained a bit clearer for people.

Updated original post
RE: status script by CookieRevised on 10-15-2010 at 11:43 AM

Maybe, but I find it clear enough as it is though.

ChatWnds is just a name for the type of the object, it is not the object's assigned name.  This is btw exact the same with 'Contacts', and some other objects like the 'DataBloc' object, 'Emoticon' object, 'Emoticons' object, ... The phraeses are also all the same:

quote:
The ChatWnds Object
The ChatWnds object is used to iterate a list of chat windows returned by a function of the API such as Messenger::CurrentChats.

The Contacts Object
The Contacts object is used to iterate a list of contacts returned by a function of the API such as Messenger::MyContacts or ChatWnd::Contacts.

The DataBloc Object
The DataBloc object represents a memory block created by Interop.Allocate.

This is different than global objects. Which are also described just like that. eg:
quote:
The MsgPlus Object
The MsgPlus object is a global object that gives access to various properties and functions related to Messenger Plus!.

The scripting docs were never meant to explain the difference between local and global objects/variables, and the difference between types and names though. It is supposed you have a basic knowledge of scripting.

It could use some very basic examples for each object/property though. Maybe that would take away some of the confusion...
RE: status script by puortant on 10-21-2010 at 02:25 AM

thank you guys

but i want to know how to use it


can you make it like a script file plz
thank you so much Spunky

it is worked now

but I also want

when i close the conversation
return status online
RE: status script by CookieRevised on 10-21-2010 at 04:58 AM

As soon as you have closed all open conversations, the script will already set your status to what it was before you opened the conversations.


RE: status script by puortant on 10-21-2010 at 06:23 AM

I've tested  this script but my status stil buzy when i closed conversation




Javascript code:
--------------------------------------------------------------------------------

var old_status = "online";

function OnEvent_ChatWndCreated(){
  if(Messenger.CurrentChats.Count > 0){
    if(old_status === "online") old_status = Messenger.MyStatus;
    Messenger.MyStatus = STATUS_BUSY;
  }
}

function OnEvent_ChatWndDestroyed(){
  if(Messenger.CurrentChats.Count === 0){
    Messenger.MyStatus = old_status
    old_status = "online";
  }
}

--------------------------------------------------------------------------------


RE: status script by CookieRevised on 10-21-2010 at 07:22 AM

You're not supposed to fill something in in that string variable!
It does not define what status is being set after all the chat windows are closed.
it actually doesn't matter what you fill in there, any random string will do, as long as you keep it the same in all the used strings in the entire script.

------

This said, there is a bug in the script.
  if(Messenger.CurrentChats.Count === 0){
should be
  if(Messenger.CurrentChats.Count === 1){
Reason being that OnEvent_ChatWndDestroyed() is executed _before_ the chat window is destroyed (which is logical, considering it needs to pass the ChatWnd object for the window which is going to be destroyed).

------

and
  if(Messenger.CurrentChats.Count > 0)
isn't needed at all, the number of chats will always be >0 in the OnEvent_ChatWndCreated() event because this event is fired _after_ the chat is created (again logical, because of the same reason above). But this isn't a bug though, it's just redundant code.

------

Thus:

Javascript code:
var old_status = "";
 
function OnEvent_ChatWndCreated() {
    if (old_status === "") old_status = Messenger.MyStatus;
    Messenger.MyStatus = STATUS_BUSY;
}
 
function OnEvent_ChatWndDestroyed() {
  if (Messenger.CurrentChats.Count === 1) {
    Messenger.MyStatus = old_status;
    old_status = "";
  }
}


RE: status script by Spunky on 10-21-2010 at 08:56 AM

Good points Cookie (as usual)

Just to clarify, you don't have to tell the script to put you back to "online". It remembers what you were before it changed to "busy" and restores it for you automatically. Example being, if you were "Away", it would change to "busy", then back to "away" when you closed all of your chat windows.

"Busy" would stay the same whether or not a chat window was open because of this.


RE: RE: status script by puortant on 10-21-2010 at 12:16 PM

quote:
Originally posted by CookieRevised
You're not supposed to fill something in in that string variable!
It does not define what status is being set after all the chat windows are closed.



this script does not work when i dont fill any thing
But he was working when I added "online"  for a quotation mark


I got this message before i add "online"




couldnt  start script

The script may be defective or you may not have the proper pivileges to
run scripts

RE: status script by puortant on 10-21-2010 at 12:32 PM

i have fix my problme now

thank you so much guys


RE: status script by CookieRevised on 10-21-2010 at 01:46 PM

quote:
Originally posted by puortant
quote:
Originally posted by CookieRevised
You're not supposed to fill something in in that string variable!
It does not define what status is being set after all the chat windows are closed.
this script does not work when i dont fill any thing
But he was working when I added "online"  for a quotation mark

I got this message before i add "online":

couldnt  start script
The script may be defective or you may not have the proper pivileges to
run scripts
That is not possible.
It would have worked in exactly the same way as if you didn't entered "online".

The first time you probably did something wrong when copying the script. That's the only reason why you could have got that error message.



quote:
Originally posted by puortant
i have fix my problme now
(y)

RE: status script by puortant on 10-21-2010 at 10:14 PM

it is working now :)

But I want to modify this script..( if you want).
whenI'm appear offline
I do not want to change my status to buzy when i open conversation

i am very sorry if I disturbed you



RE: status script by Spunky on 10-22-2010 at 07:46 AM

Javascript code:
var old_status = "";
 
function OnEvent_ChatWndCreated() {
    if (old_status === "") old_status = Messenger.MyStatus;
    if (Messenger.MyStatus != STATUS_INVISIBLE) Messenger.MyStatus = STATUS_BUSY;
}
 
function OnEvent_ChatWndDestroyed() {
  if (Messenger.CurrentChats.Count === 1) {
    if (Messenger.MyStatus != STATUS_INVISIBLE) Messenger.MyStatus = old_status;
    old_status = "";
  }
}


RE: status script by puortant on 10-22-2010 at 12:23 PM

Thank you alot