Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Photosynthesis... kinda

Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
07-01-2005 08:14
Just a random little script to make a prim expand and contract throughout the SL day, based on the amount of daylight and non-daylight the prim recieves. It also keeps the percent of volume from the max of 10 cubic meters ( I think I did the math right for it *crosses fingers*). I tried to keep it pretty simple and kinda random. Enjoy.

CODE
vector direction;
vector scale;
integer random_number;
default
{
state_entry()
{
llSetTimerEvent(1);
}
timer()
{
float FloatValue = llFrand(60);
if (FloatValue < 10)
{
float AddedValue = FloatValue + 20;
llSetTimerEvent(AddedValue);
}
else
{
llSetTimerEvent(FloatValue);
}
direction = llGetSunDirection();
if ( direction.z > 0 )
{
scale = llGetScale();
float product_XY = scale.x * scale.y;
float product_XYZ = product_XY * scale.z;
float growth_percent = product_XYZ * .100;
llSetText((string)growth_percent + "%",<1,1,1>,1.0);
random_number = llRound(llFrand(2));
if((random_number == 0) && (scale.x != 10.00000))
{
llSetScale(<scale.x + 0.00100,scale.y,scale.z>);
}
if((random_number == 1) && (scale.y != 10.00000))
{
llSetScale(<scale.x,scale.y + 0.00100,scale.z>);
}
if((random_number == 2) && (scale.z != 10.00000))
{
llSetScale(<scale.x,scale.y,scale.z + 0.00100>);
}
if(scale == <10.00000, 10.00000, 10.00000>)
{
llSetText("Growth 100%",<1,1,1>,1);
}
}
else
{
scale = llGetScale();
float product_XY = scale.x * scale.y;
float product_XYZ = product_XY * scale.z;
float growth_percent = product_XYZ * .100;
llSetText((string)growth_percent + "%",<1,1,1>,1.0);
random_number = llRound(llFrand(2));
if((random_number == 0) && (scale.x > 0.25500))
{
llSetScale(<scale.x - 0.00500,scale.y,scale.z>);
}
if((random_number == 1) && (scale.y > 0.25500))
{
llSetScale(<scale.x,scale.y - 0.00500,scale.z>);
}
if((random_number == 2) && (scale.z > 0.25500))
{
llSetScale(<scale.x,scale.y,scale.z - 0.00500>);
}
}
}
}
_____________________
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
07-04-2005 08:39
/15/84/52202/1.html
_____________________
i've got nothing. ;)