This script i take for the store:
integer up;
vector startSize;
float endSize = 0.196; //In meters, how long the prim will end up being along it's Z axis.
float rate = 0.1; //In meters, how much it stretches every roughly 0.5 seconds.
curtainTransition()
{
if (up)
{
startSize = llGetScale();
float i;
for (i = startSize.z; i < endSize; i += rate)
{
vector scale = llGetScale();
vector pos = llGetLocalPos();
llSetScale(<scale.x, scale.y, scale.z + rate>
;llSetPos(<pos.x, pos.y, pos.z - (rate / 2)>
;}
up = FALSE;
}
else if (!up)
{
float i;
for (i = endSize; i > startSize.z; i -= rate)
{
vector scale = llGetScale();
vector pos = llGetLocalPos();
llSetScale(<scale.x, scale.y, scale.z - rate>
;llSetPos(<pos.x, pos.y, pos.z + (rate / 2)>
;}
up = TRUE;
}
}
default
{
state_entry()
{
up = TRUE;
startSize = llGetScale();
//llListen(55555, "", NULL_KEY, "curtain"
; //Uncomment this if you're using the listen event for activation.//llListen(55555, "", llGetOwner(), "curtain"
; //Uncomment this instead if you only want it to listen to the owner.}
on_rez(integer start_param)
{
up = TRUE;
startSize = llGetScale();
}
///Below this line are three means of activation. You might want to delete the ones you're not using.
touch_start(integer total_number) //Use this event to make the curtian activate when touched.
{
//if (llDetectedKey != llGetOwner()) return; //Uncomment this line to make owner-only.
curtainTransition();
}
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "curtain"
curtainTransition(); //Activates the curtains when this prim receives a link message containing "curtain" as the string. To make link_message owner only, that will have to be specified in the script sending the link_message.}
listen(integer channel, string name, key id, string message)
{
if (message == "curtain"
curtainTransition(); //Activates the curtains when it hears "curtain" on channel 55555. (Make sure to uncomment the llListen() line in state_entry() if you're going to use this.)}
}