What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » online time script

Pages: (2): « First [ 1 ] 2 » Last »
online time script
Author: Message:
stuartbennett
Senior Member
****

Avatar

Posts: 952
Reputation: 1
43 / Male / Flag
Joined: Nov 2003
O.P. online time script
i did run a search for this script's thread but cant find one for it so do excuse me if there is one.

i have a suggestion for a new feature, can you add a way to configure the time format displayed in your PSM so instead of

seconds, minutes, hours, days

it could display as

days, hours, minutes, seconds.

or a variety of other prebuilt formats for the user to choose from.
08-12-2006 03:21 PM
Profile E-Mail PM Web Find Quote Report
Chris4
Elite Member
*****

Avatar

Posts: 4461
Reputation: 84
33 / Male / Flag
Joined: Dec 2004
RE: online time script
What do you mean 'instead of seconds, minutes, hours, days'. Where is this? A different script?
Twitter: @ChrisLozeau
08-12-2006 03:32 PM
Profile PM Find Quote Report
stuartbennett
Senior Member
****

Avatar

Posts: 952
Reputation: 1
43 / Male / Flag
Joined: Nov 2003
O.P. RE: online time script
ok heres the script i am talking about, the attached script determines how long you have been signed in to your Windows Live messenger and display the results in your personal message. it presently displays it as

Online Time: 37 Seconds 41 Minutes 6 Hours 0 Days

however i feel that the format is too confusing i would prefer that that information had been displayed as.

Online Time: 0 Days 6 Hours 41 Minutes 37 Seconds

you could event do it like:

Online Time: 00:06:41:37

the point is a variety of variations on format would be offered and the user could make a choice on how that information is displayed to them based on their personal preference.

.plsc File Attachment: Online Time.plsc (743 bytes)
This file has been downloaded 151 time(s).
08-12-2006 05:15 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: online time script
This is Line 32 of the Online Time.js
code:
var OnlineTime = "Online Time: " + Sec + " Seconds " + Min + " Minutes " + Hrs + " Hours " + Days + " Days";

Why not just change it to what you want?
code:
var OnlineTime = "Online Time: " + Days + " Days " + Hrs + " Hours " + Min + " Minutes " +  Sec + " Seconds";

Wasn't that hard was it?

Or if you want to get fancy

code:
var OnlineTime = 'Online Time:';
if (Days > 1){
    OnlineTime += Days + ' Days';
}else if (Days == 1){
    OnlineTime += Days + ' Day';
}

if (Hrs > 1){
    OnlineTime += Hrs + ' Hours';
}else if (Hrs == 1){
    OnlineTime += Hrs + ' Hour';
}

if (Min > 1){
    OnlineTime += Min + ' Minutes';
}else if (Min == 1){
    OnlineTime += Min + ' Minute';
}

if (Secs > 1){
    OnlineTime += Secs + ' Seconds';
}else if (Secs == 1){
    OnlineTime += Secs + ' Second';
}




[edit]

Beat ya cook ;)

[/edit]

This post was edited on 08-12-2006 at 05:31 PM by matty.
08-12-2006 05:20 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: online time script
1) Simply edit the script to show a different line. The script is dead easy (even for those who don't know much about programming). The only line you should change is
code:
var OnlineTime = "Online Time: " + Sec + " Seconds " + Min + " Minutes " + Hrs + " Hours " + Days + " Days";
to
code:
var OnlineTime = "Online Time: " + Days + " Days " + Hrs + " Hours " + Min + " Minutes " + Sec + " Seconds";


2) Note that the script is poorly written. I would actually not suggest to use it in its current form as it doesn't take in account singular values, doesn't take in account flood limits, constantly needs JScript to change the type of variables (string and numbers are mixed), you can't turn it off, etc, etc...


3) The script is very very highly annoying to all your contacts since it changes your personal message every second; be prepared to get banned from your contacts' contactlists when you use it.


EDIT: I need to refresh before I reply

This post was edited on 08-12-2006 at 05:31 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
08-12-2006 05:29 PM
Profile PM Find Quote Report
stuartbennett
Senior Member
****

Avatar

Posts: 952
Reputation: 1
43 / Male / Flag
Joined: Nov 2003
O.P. RE: online time script
thanks i did try changing that line earlier this afternoon but for some reason it didnt work, i obvious miss typed the syntax somewhere oh well thanks for the help, so cookie or anyone how would you improve the script, maybe i can make it a little project for me to fix the script as a way to learn more about writing scripts.
08-12-2006 06:31 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: online time script
Myself I would do something like this:

code:
var time_counter;

function OnEvent_Signin(sEmail){ MsgPlus.AddTimer('uptime',10000); }

function OnEvent_Timer(sTimerId){
    if (sTimerId == 'uptime') {   
        time_counter = time_counter + 10;

        var days = time_counter / (24 * 3600);
        if (days > 0){ timer_counter = timer_counter - (24*3600*days); }
        var hours = timer_counter / 3600;
        if (hours > 0){ timer_counter = timer_counter - (3600*hours); }
        var minutes = timer_counter / 60;
        Messenger.MyPersonalMessage = 'Online Time: ' + days + ':' + hours + ':' + minutes;
        Debug.Trace(Messenger.MyPersonalMessage);
        MsgPlus.AddTimer(sTimerId,10000);
    }
}

Might work now I fixed a small part of the code.

This post was edited on 08-12-2006 at 08:43 PM by matty.
08-12-2006 07:03 PM
Profile E-Mail PM Find Quote Report
stuartbennett
Senior Member
****

Avatar

Posts: 952
Reputation: 1
43 / Male / Flag
Joined: Nov 2003
O.P. RE: online time script
ok now what difference would that have exactly out of interest.
08-12-2006 07:42 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: online time script
quote:
Originally posted by stuartbennett
ok now what difference would that have exactly out of interest.
Less processing time because I am not comparing strings to numbers. When you compare a string to a number Javascript has to convert it internally to be able to compare it.
08-12-2006 07:58 PM
Profile E-Mail PM Find Quote Report
stuartbennett
Senior Member
****

Avatar

Posts: 952
Reputation: 1
43 / Male / Flag
Joined: Nov 2003
O.P. RE: online time script
sorry matty but they way you coded it has bropken the script and it will no longer function at all. from what i can see from testing the code the original code is the only version that works, if you can give me a working code then ill test it.

This post was edited on 08-12-2006 at 08:27 PM by stuartbennett.
08-12-2006 08:18 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » 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