Jump to content

Precise time


Shihan Feiri
 Share

You are about to reply to a thread that has been inactive for 4083 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Is posible and if is, what to use, that script triger predefined event in precise time  (second life time ).

 

For example: betwen 02:00pm and 04:00 pm that script change color in red in 08:00pm - 10pm to change color in green etc.

And  color changing is just example.

 

If someone have similar script pls IM me.

 

tnx

Link to comment
Share on other sites

ok, I talk about RL time. If is 2pm script stop with use one data ( eg. Green color) and start to use predefined data (eg. Red data)  for this time  until next time period.

So eg. in 2pm script use data 1, in 3 pm script use data 2, in 3 pm script use data 3 etc.

Link to comment
Share on other sites

I think what Darkie is getting at is...

"how precise do you need to be?"

 

having something happen at an exact predetermined second is pretty hard to near impossible with LSL. for instance, the region the object is on may be down, or the object may be in inventory so can't do anything.

 

but, if you want to use a certain set of data if it's after X:YZ time, then that's easy. Just check llGetUnixTime, or llGetWallclock and see decide from that what to use right now.

Link to comment
Share on other sites

There is no need to make a loop for checking the actual time
The following script will set the color when entered and then on every second hour on hours=0,2,4,6,8,10,12,14,16,18,20,22
That is 12 events in 24 hours

// time synchronized color changer// will change on full even hours// based on PST (SL time) time// by Dora Gustafson, Studio Dora 2011vector black=< 0.0, 0.0, 0.0>;vector red=< 1.0, 0.0, 0.0>;vector green=< 0.0, 1.0, 0.0>;vector blue=< 0.0, 0.0, 1.0>;timeColor(){    integer nowSec=(integer)llGetWallclock();    integer nowTwoHour=2*(nowSec/7200);    integer nxtTwoHour=nowTwoHour+2;    integer timeUntilEvent=nxtTwoHour*3600-nowSec;    llSetTimerEvent( (float)timeUntilEvent );    if (nowTwoHour==0) llSetColor( black, ALL_SIDES);    else if (nowTwoHour==2) llSetColor( red, ALL_SIDES);    else if (nowTwoHour==4) llSetColor( blue, ALL_SIDES);    else if (nowTwoHour==6) llSetColor( green, ALL_SIDES);    else if (nowTwoHour==8) llSetColor( black, ALL_SIDES);    else if (nowTwoHour==10) llSetColor( red, ALL_SIDES);    else if (nowTwoHour==12) llSetColor( blue, ALL_SIDES);    else if (nowTwoHour==14) llSetColor( green, ALL_SIDES);    else if (nowTwoHour==16) llSetColor( black, ALL_SIDES);    else if (nowTwoHour==18) llSetColor( red, ALL_SIDES);    else if (nowTwoHour==20) llSetColor( blue, ALL_SIDES);    else if (nowTwoHour==22) llSetColor( green, ALL_SIDES);}default{    state_entry()    {        timeColor();    }    timer()    {        timeColor();    }}

The colors in the script are just an example and will not match the wishes in the OP

Note: time calculations are not optimized but written step by step for clarity

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4083 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...