Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to reset back to Original size of prim? (after resizing)

Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
10-11-2008 12:02
I know how to resize a prim using llGetScale() , but is there also a way to store the value of the *starting* size of the prim, also using llGetScale()?

After the resizing is done, I want to be able to restore the prim back to the original size.


thx for any help with this
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
10-11-2008 12:37
Define "starting". You mean the value when the script is first started and reset? Sure:

CODE

vector startScale;

default
{
state_entry()
{
startScale = llGetScale();
}
}


Or do you mean ONLY the first time the script is ever executed? That's a little trickier, but you could use something like the prim's description field:

CODE

vector startScale;

default
{
state_entry()
{
string desc = llGetObjectDesc();
if (desc != "" && llGetSubString(desc, 0, 0) == "<")
{
startScale = (vector)desc;
} else
{
startScale = llGetScale();
llSetObjectDesc((string)startScale);
}
}
}


Keep in mind that if you use the prim's description field for a specific use in your script, you had better make sure there are no OTHER scripts that depend on that field.

Note: The above scripts have not been compiled, and are meant as a starting point anyway, rather than as complete scripts. Use them only as pseudo-code to learn from.
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
10-11-2008 13:41
Thanks Hewee, for clarifying that. I meant the latter, and now very glad to be able to experiment with the description field - haven't used that before.
Much appreciated!