What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » how can i get the system time?

how can i get the system time?
Author: Message:
Gareth_2007
Junior Member
**


Posts: 21
Joined: Mar 2007
O.P. how can i get the system time?
say it was 9 am merlin would say merlin.Speak("Good Morning");
and he would say that untill 12pm when he would say merlin.Speak("Good afternoon"); any ideas how that could be scripted? cheers
03-07-2007 01:42 AM
Profile E-Mail PM Find Quote Report
Dennis Mike
Junior Member
**

Avatar

Posts: 59
Reputation: 2
34 / Male / –
Joined: Jan 2007
RE: how can i get the system time?
http://www.msgpluslive.net/scripts/view/134-xFecha/
this script is the answer
[Image: xFecha.jpg]

This post was edited on 03-07-2007 at 02:42 AM by Dennis Mike.
03-07-2007 02:38 AM
Profile PM Web Find Quote Report
xsylvain2
Junior Member
**

Avatar
MsgPlus! For Evermore

Posts: 17
50 / Male / –
Joined: Feb 2007
RE: For the Merlin Fans
quote:
Originally posted by Gareth_2007
say it was 9 am merlin would say merlin.Speak("Good Morning");
and he would say that untill 12pm when he would say merlin.Speak("Good afternoon"); any ideas how that could be scripted? cheers


I put this code in my Merlin script.:P

code:
// function to have system hour. (Y)
================================ 
function TimeD(){
    var d, H, s = "";
    var c = ":";
    //var e = " Minutes "; var f = " Seconds "; var g = " Miliseconds!"
    d = new Date();
    H = d.getHours()
    s += d.getHours() + c;
    Debug.Trace("S ="+s);     
    if (H == 13){s  ="1:"};
    if (H == 14){s  ="2:"};
    if (H == 15){s  ="3:"};
    if (H == 16){s  ="4:"};
    if (H == 17){s  ="5:"};
    if (H == 18){s  ="6:"};
    if (H == 19){s  ="7:"};
    if (H == 19){s  ="8:"};
    if (H == 19){s  ="9:"};
    if (H == 19){s  ="10:"};
    if (H == 19){s  ="11:"};
    s += d.getMinutes();
    if (H <  12){s +=" am "};   
    if (H >  12){s +=" pm "};     
    Debug.trace("TIME = "+s);
    //s += (" and ")+d.getSeconds() + f;    //if you want more precision
    //s += d.getMilliseconds() + g;         //if you want more precision

    return(s);
}

    // exemple : Merlin.Speak(TimeD())
    // Whit the condotional code you can.

code:
// To have the current date of the style of the medieval age.  (A)
=============================================================
function DateD(){

var d, day, mont, date, year, x, y, s = "\\spd=180\\We are ";     

var x = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

var y = new Array("January","February","March ","April","May","June","July","August","September","October","November","December");

d = new Date(); day = d.getDay(); month = d.getMonth(); date = d.getDate(); year = d.getFullYear();

if (date == 1){
date += "st"
}else if (date == 2){
date += "nd"
}else if (date == 3){
date += "rd"
}else if (date > 3 ){
date += "th"
}else if (date == 21){
date += "st"
}else if (date == 22){
date += "nd"
}else if (date == 23){
date += "rd"
}else if (date > 23){
date += "th"
}else if (date == 31){
date += "st"
        }
return(s +=("Today is ")+x[day]+(", ")+y[month]+(" ")+date+(" in the years of grace ")+year);
}


It work perfectly add the command Merlin.Speak(GetTimeOfDay) in
the function : OnEvent_SigninReady(Email)

To grab period of day. 8-|
===========================

code:
function GetTimeOfDay(){
    var dd, hh, TimeOfDay = ""
    dd = new Date();
    hh = dd.getHours();
       
    if (dd < 5){ 
        TimeOfDay = "\\Spd=180\\Good Night!"
} else if (hh < 9){
        TimeOfDay = "\\Spd=180\\Good Morning!"
} else if (hh < 12){
        TimeOfDay = "\\Spd=180\\Good Morning!"               
} else if (hh == 12){
        TimeOfDay = "\\Spd=180\\Good noon!"       
} else if (hh < 17){
        TimeOfDay = "\\Spd=180\\Good after noon!"       
} else if (hh == 17){
        TimeOfDay = "\\Spd=180\\Good Supper!"
} else if (hh < 21){ 
        TimeOfDay = "\\Spd=180\\Good Evening !"           
} else if (hh >= 21){
        TimeOfDay = "\\spd=180\\Good Night!" 
    }
    return (TimeOfDay);
}

This post was edited on 03-18-2007 at 09:40 PM by xsylvain2.
03-11-2007 07:46 PM
Profile 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