Jump to content

CaseyRedDragon Wise

Resident
  • Posts

    6
  • Joined

  • Last visited

Posts posted by CaseyRedDragon Wise

  1. Well see it gets the time for the 4 time zones from the llGetWallclock  which will adjust for DST, but Hawaiian and Alaskan don't have DST so I would have to make the  script be able to know when DST is and then adjust for it which would be long. There is a small bug in the script, sometimes on the last day of the month instead of saying 7-31-2012 it mite say 8-0-2012.

  2. I'm making a script that will log sim crashes. I was going to have it log them in a notecard but now I found out that a script can't write in a notecard. I was thinking of using a list instead but what I like to know is if a script stores data in a list and the sim restarts won't the data be erased? If so how can I get a script to save some data and keep it even if the sim restarts?

  3. This script will tell the time in AM/PM time or 24 hour time for ether of the four USA Time Zones and also tells the date and what day of the week it is. I was going to put this on the wiki but I couldn't figure it out.

    // Time Script by CaseyRedDragon Wise
    // feel free to IM me if you have any questions or comments
    
    integer dateoff;
    string smin;
    string sseconds;
    string timeofday;
    string time;
    
    //Set timezone to the number corresponding to the time zone you want
    //Pacific Time Zone = 0
    //Mountain Time Zone = 1
    //Central Time Zone = 2
    //Eastern Time Zone = 3
    integer timezone = 3;
    
    //Set type to "standard" for AM/PM Time or set to "military" for Military Time
    string type = "standard";
    
    string uStamp2WeekdayStr( integer vIntYear, integer vIntMonth, integer vIntDay ){
    return llList2String ( ["Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday"],
    (vIntYear + (vIntYear >> 2) - ((vIntMonth < 3) & !(vIntYear & 3)) + vIntDay
    + (integer)llGetSubString( "_033614625035", vIntMonth, vIntMonth )) % 7 );
    }
    
    default
    {
        state_entry()
        {
            llSetTimerEvent(1.0);
        }
        
        timer()
        {
           integer seconds = llFloor(llGetWallclock());
           //llSay(0, (string)seconds);
           integer min = llFloor(seconds/60);
           seconds = seconds - (min*60);
           integer hour = llFloor(min/60);
           min = min - (hour*60);
           hour = hour + timezone;
           if(hour >=  24) {hour = hour - 24;}
           
           integer mili = hour;
           
           if(hour < 12) {timeofday = "AM";}
             else {timeofday = "PM";}
           
           if(hour > 12) {hour = hour - 12;}
           if(hour == 0) {hour = 12;}
           string shour = (string)hour;
           if(min < 10) {smin = "0"+(string)min;}
           else { smin = (string)min;}
           if(seconds < 10) { sseconds = "0"+(string)seconds;}
           else {sseconds = (string)seconds;}
           
           if(type == "standard")  {
           time = shour + ":" + smin + ":" + sseconds + " " + timeofday; }
           if(type == "military")  {
           time = (string)mili + ":" + smin + ":" + sseconds; }
           
           list timepart = llParseString2List(llGetTimestamp(), ["T", ":"], []);
            integer uhour  = (integer)llList2String(timepart, 1);
           if(uhour < 12 && mili > 12) {   // -1 day
               dateoff = 1;  }
               else  {
                dateoff = 0;  }
            list dateComponents = llParseString2List(llGetDate(), ["-"], []);
            integer year  = (integer)llList2String(dateComponents, 0);
            integer month = (integer)llList2String(dateComponents, 1);
            integer day   = (integer)llList2String(dateComponents, 2);
            day = day - dateoff;
            
            string date = uStamp2WeekdayStr(year, month, day) + " " + (string)month + "-" + (string)day + "-" + (string)year;
    
           string datetime = time + "\n" + date;
           llSetText(datetime, ZERO_VECTOR, 1.0);
           
        }
    }

     

    • Like 1
×
×
  • Create New...