Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Linkset Tiny Prim Adjustment

Lily Nozaki
Registered User
Join date: 15 Jan 2007
Posts: 1
01-24-2008 12:07
This script was written to avoid the need to resize individual prims in modifiable attachments that need to be made smaller, such as prim hair that would otherwise take a year to fix by hand and is made for people with heads the size of blimps.

To use it, drop it in the root prim of a modifiable object, and after the script declares it is ready, take the object back into inventory, rez it again, and then select it and click from the menu bar Tools -> Set Script to Running in Selection. When this dialog says that it is finished activating all the scripts, the scripts will have already resized any minimum prim dimensions to the global variable min_size and deleted themselves from all prims. The object should then be shrinkable in edit mode.

CODE
// This script is freely available with no limitations on usage, modifications, or redistribution, and with no guarantee of support or warranty.

float min_size = 0.015;

scale() {
vector scale = llGetScale();
if (scale.x < min_size) {
scale.x = min_size;
}
if (scale.y < min_size) {
scale.y = min_size;
}
if (scale.z < min_size) {
scale.z = min_size;
}
llSetScale(scale);
}

default {
state_entry() {
if (llGetObjectPermMask(MASK_OWNER) & PERM_MODIFY) { // object can be modified
if (llGetLinkNumber() == 1) { // script is running in the root prim
if (llGetNumberOfPrims() > 1) { // 2+ prim object
integer i = 0;
integer prims = llGetNumberOfPrims();

for (i = 2; i <= prims; i++) { // pass a copy of the script to all child prims
llGiveInventory(llGetLinkKey(i), llGetScriptName());
}

scale();

llSay(0, "Loading stage finished. Take the object back into inventory, rez it again, then select it and choose from the menu Tools -> Set Script to Running in Selection. The process is complete when the dialog says all scripts have been reset.");
llRemoveInventory(llGetScriptName());
} else {
scale();
llSay(0, "One-prim object, finished.");
}
} else { // script is running in a child prim, scale prim and delete script
scale();
llRemoveInventory(llGetScriptName());
}
} else {
llSay(0, "Unmodifiable object; deleting script.");
llRemoveInventory(llGetScriptName());
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump
01-25-2008 21:10
;-)
_____________________
i've got nothing. ;)
Tyrr Leavitt
Registered User
Join date: 10 Jan 2007
Posts: 3
Bump and Tnx :)
03-30-2008 01:37
Tnx Lily :)