Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Link Restore Script

Oasis Perun
Registered User
Join date: 2 Oct 2005
Posts: 128
11-14-2005 21:21
I decided to write this script after watching my GF spend an hour linking and unlinking and regrouping a set of prim hair and a hat. but i also have a few other uses in store.. let me know what yal think .. or if there is anything that needs to be changed


Commands::
"/55 id" :: all prims running this script will respond with there name and number of prims saved

"/55 <name> save" :: saves the keys for each Prim in the linkset
"/55 <name> restore" :: puts the "saved" links back together in order(will have to run this command twice is scripted prim is not attached to other prims.)

CODE
 list linkedkeys = []; //this is the list of keys in link order including this prim
string setname = "mod2";// this is the sub object answers too
restorealllinks()
{
integer x = 1;
llBreakAllLinks();
for(x = 0; x < llGetListLength(linkedkeys);x++)
{
llCreateLink(llList2Key(linkedkeys, -x), TRUE);
llOwnerSay( (string)(x+1) + "added so far");
}

}
savealllinks()
{
linkedkeys = [];
integer x = 0;
if (llGetNumberOfPrims() == 1)
{
llOwnerSay("Attach me to something first");
return;
}
for (x = 1; x <= llGetNumberOfPrims(); x++)
{
//llOwnerSay((string)llGetLinkKey(x));
llOwnerSay((string)x + " saved");
linkedkeys += llGetLinkKey(x);
llOwnerSay((string)llList2Key(linkedkeys, x - 1));
}

}




default
{



state_entry()
{
// get permission to change links for objects owned by AV.
llRequestPermissions(llGetOwner(),PERMISSION_CHANGE_LINKS);
llListen(55,"",llGetOwner(),"");

}



listen(integer channel, string name, key id, string message)
{
list pmessage = llParseString2List(message, [" "],[]);
llOwnerSay(name);
if (llList2String(pmessage,0) == "id") llOwnerSay(setname + ":" + (string)llGetListLength(linkedkeys) + "prims.");
if (llList2String(pmessage,0) == setname)
{
llOwnerSay( "Thats me boss");

if (llList2String(pmessage,1) == "save") savealllinks();
if (llList2String(pmessage,1) == "restore") restorealllinks();

}

}




}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
original thread
11-15-2005 07:23
/15/73/71754/1.html
_____________________
i've got nothing. ;)