What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] Fast & Simple Away/Busy System :)

Pages: (3): « First « 1 2 [ 3 ] Last »
[Request] Fast & Simple Away/Busy System :)
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: [Request] Fast & Simple Away/Busy System :)
Ok, I'll change some of things around. The reason for using the registry a lot is because globsl variables just didn't seem to be working (would change to undefined when read from a function).

I didn't realise there was a way to use a date or time object... Might have to look into that then as well now :p

Thanks for the input :D
<Eljay> "Problems encountered: shit blew up" :zippy:
08-12-2006 11:58 AM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Request] Fast & Simple Away/Busy System :)
If a global variable is 'undefined' when you read it inside a function it is most likely not a global variable in the first place or wrongly declared to begin with.

Seeing some of your code, you indeed have some trouble with that.
Remember that every variable you use must be declared first. If you don't do that JScript will do it for you but this makes bad code and is prone to mistakes and confussion (as shown in your code with the 'Window' variable.)

The first time you use a variable make it a habit to always declare it using the 'var' statement. Depending on where this var statement occurs it is a global variable (when the declaration is done outside a function) or a local variable (when it is done inside the function; and this means the variable will only be valid inside this function).

Also don't confuse parameters of funtions with variables, those are two different things (again refering to the use of the 'Window' variable inside the OnMainEvent_CtrlClicked function which is of no need since 1) it isn't delcared properly and 2) the function already passed the window object as a variable).

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

Your script has, besides the stuff I already said, other issues as well.

Eg: when contacts are added or removed from the contact list, your script will leave entries for those contacts in the registry or even malfunction.

Eg: In convo's with multiple contacts your script doesn't behave as intended.

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

PS: also the XML file has same strange things in it, making me believe you copied it from somewhere else maybe (?)...

No need for the global colors definition.
Also the name value of the interfaces tag seems a bit strange...

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

Attached is the rewritten and optimized script (without the use of timers and registry (and also compatible with Plus!3 format codes)).

If you wish you can take a look at it, and use it. If you don't wish and want to do it all yourself first, ignore it for now ;)

EDIT: updated, editing 1 line to be even more shorter....

.plsc File Attachment: Away-Busy.plsc (3.09 KB)
This file has been downloaded 316 time(s).

This post was edited on 08-19-2006 at 12:47 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
08-12-2006 01:13 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: [Request] Fast & Simple Away/Busy System :)
Thanks a lot, thats fantastic!

The XML file was either generated by XMLSpy using the Schema or was borrowed from another file. I use the same XML file for most of my interfaces and just change controls and things.

I've been using ActionScript (Flash) for too long now. When using global variables I'd just use
code:
_root.myVar = "blah";
Obviously, not possible with this.

I have declared variables out of functions etc in other scripts but didn't define the type so just using something like
code:
var Myvar;
var myVar = "";


I've taught myself a lot of languages, but rarely get past the basics.
This is (after Java) one of the hardest to get used to, probably because it seems to borrow some parts from other languages, but not others :p

I like to learn though and I also like to help, so I'll keep trying :D
<Eljay> "Problems encountered: shit blew up" :zippy:
08-12-2006 03:33 PM
Profile PM Find Quote Report
artfuldodga
Full Member
***

Avatar

Posts: 178
Joined: Mar 2006
O.P. RE: [Request] Fast & Simple Away/Busy System :)
nice job on the script CookieRevised :)

edit: for some reason, after.. i set busy away... busy.. a bunch of times, restarted messenger, the scripts popup window asking you for the reason, won't popup asking anymore, however it does set me to away .. just with <no reason> (i did edit the script so it didnt use the /me command, and took out the bold tags, dont' know if that had any affect, worked for a bit :)

This post was edited on 08-12-2006 at 05:08 PM by artfuldodga.
08-12-2006 04:58 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: [Request] Fast & Simple Away/Busy System :)
quote:
Originally posted by SpunkyLoveMuff
I have declared variables out of functions etc in other scripts but didn't define the type so just using something like
code:
var Myvar;
var myVar = "";


That's no problem.

The value assigned to the variable isn't important (JScript changes the type of the variable on the fly if it needs to be anyway), as long as it is declared with the var statement that's enough....

I assigned values to the global variables using the new operator in the script I attached because:
1) it is easy to see what the variable is going to be used as.
2) it also initializes the variables to the proper values (especially important for the DateTimeSet variable which is assign the current date and time at that point when the script initializes).

;)

quote:
Originally posted by rockie
edit: for some reason, after.. i set busy away... busy.. a bunch of times, restarted messenger, the scripts popup window asking you for the reason, won't popup asking anymore, however it does set me to away .. just with <no reason> (i did edit the script so it didnt use the /me command, and took out the bold tags, dont' know if that had any affect, worked for a bit :)
The error is mostlikely on your part (missing the popup window because it is behind other windows for example) since as you can see from the code, nothing can go wrong with it as it is very very very basic:
code:
function OnEvent_MyStatusChange(NewStatus) {
        // Reset stuff
        Reason = "";
        CheckArray.length = 0;
        DateTimeSet = new Date();
        // Show reason window when status is away or busy
        if (NewStatus === 4 || NewStatus === 7) {
                MsgPlus.CreateWnd("interface.xml","Main");
        }
}
It does nothing more than resetting the reason, the array with emails to check and the datetime each time you change status. And if the new status is either Away or Busy it shows the popup window.

In fact, since it shows the popup each time you change status to away or busy and since you didn't set any reason, you mostlikely would ended up with a whole bunch of popup windows (this can be overcome by adding a check for it before the window is created though; but that isn't the issue here).

(also note that the script doesn't set any status, it reacts on status change)

This post was edited on 08-12-2006 at 05:53 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
08-12-2006 05:37 PM
Profile PM Find Quote Report
Pages: (3): « First « 1 2 [ 3 ] 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