Difference between revisions of "User:Toy Wylie/Meeroos/Cycle Script"

From Second Life Wiki
Jump to navigation Jump to search
(First script version)
 
(Added nocturnal version)
 
Line 1: Line 1:
== Diurnal Version: ==
<lsl>float INTERVAL=30.0;
<lsl>float INTERVAL=30.0;
integer HOUR_OFFSET=-4;
integer HOUR_OFFSET=-4;
Line 16: Line 19:
     "Mischievous",
     "Mischievous",
     "Lazy"
     "Lazy"
];
update()
{
    string text="";
    integer time=llGetUnixTime()+(HOUR_OFFSET*3600);
    integer day=(time/(24*60*60)) % 5;
    integer hour=(time/(60*60)) % 24;
    text+="Rise: "+llList2String(seasons,day)+"\n";
    text+="Peak: "+llList2String(seasons,(day+4) % 5)+"\n";
    text+="Fall: "+llList2String(seasons,(day+3) % 5)+"\n";
    text+="2 Wait: "+llList2String(seasons,(day+2) % 5)+"\n";
    text+="1 Wait: "+llList2String(seasons,(day+1) % 5)+"\n";
    text+="Remaining: "+(string) (24-hour)+" hours";
    llSetText(text,<1.0,1.0,1.0>,1.0);
}
default
{
    state_entry()
    {
        llSetTimerEvent(INTERVAL);
        update();
    }
    timer()
    {
        update();
    }
}</lsl>
== Nocturnal Version: ==
<lsl>
float INTERVAL=30.0;
integer HOUR_OFFSET=-4;
//                2  3    4    0    1
// Impish      ———— rise peak fall ———–
// Arrogant    rise peak fall ———— ————
// Fidgety      peak fall —–—— ———– rise
// Loyal        fall ———– ———— rise peak
// Clumsy      ———— ———— rise peak fall
list seasons=
[
    "Loyal",
    "Fidgety",
    "Arrogant",
    "Impish",
    "Clumsy"
];
];



Latest revision as of 10:23, 6 September 2012

Diurnal Version:

<lsl>float INTERVAL=30.0; integer HOUR_OFFSET=-4;

// 2 3 4 0 1 // Mischievous ———— rise peak fall ———– // Aggressive rise peak fall ———— ———— // Shy peak fall —–—— ———– rise // Friendly fall ———– ———— rise peak // Lazy ———— ———— rise peak fall

list seasons= [

   "Friendly",
   "Shy",
   "Aggressive",
   "Mischievous",
   "Lazy"

];

update() {

   string text="";
   integer time=llGetUnixTime()+(HOUR_OFFSET*3600);
   integer day=(time/(24*60*60)) % 5;
   integer hour=(time/(60*60)) % 24;
   text+="Rise: "+llList2String(seasons,day)+"\n";
   text+="Peak: "+llList2String(seasons,(day+4) % 5)+"\n";
   text+="Fall: "+llList2String(seasons,(day+3) % 5)+"\n";
   text+="2 Wait: "+llList2String(seasons,(day+2) % 5)+"\n";
   text+="1 Wait: "+llList2String(seasons,(day+1) % 5)+"\n";
   text+="Remaining: "+(string) (24-hour)+" hours";
   llSetText(text,<1.0,1.0,1.0>,1.0);

}

default {

   state_entry()
   {
       llSetTimerEvent(INTERVAL);
       update();
   }
   timer()
   {
       update();
   }

}</lsl>

Nocturnal Version:

<lsl> float INTERVAL=30.0; integer HOUR_OFFSET=-4;

// 2 3 4 0 1 // Impish ———— rise peak fall ———– // Arrogant rise peak fall ———— ———— // Fidgety peak fall —–—— ———– rise // Loyal fall ———– ———— rise peak // Clumsy ———— ———— rise peak fall

list seasons= [

   "Loyal",
   "Fidgety",
   "Arrogant",
   "Impish",
   "Clumsy"

];

update() {

   string text="";
   integer time=llGetUnixTime()+(HOUR_OFFSET*3600);
   integer day=(time/(24*60*60)) % 5;
   integer hour=(time/(60*60)) % 24;
   text+="Rise: "+llList2String(seasons,day)+"\n";
   text+="Peak: "+llList2String(seasons,(day+4) % 5)+"\n";
   text+="Fall: "+llList2String(seasons,(day+3) % 5)+"\n";
   text+="2 Wait: "+llList2String(seasons,(day+2) % 5)+"\n";
   text+="1 Wait: "+llList2String(seasons,(day+1) % 5)+"\n";
   text+="Remaining: "+(string) (24-hour)+" hours";
   llSetText(text,<1.0,1.0,1.0>,1.0);

}

default {

   state_entry()
   {
       llSetTimerEvent(INTERVAL);
       update();
   }
   timer()
   {
       update();
   }

}</lsl>