////////////////////////////////////////////////////////// // (C) Wizardry and Steamworks - 2011, License: GPLv3 // // // // -* OBJECT MIRROR *- // // // ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // About: Mirrors all the sculpts in a link-set. // ////////////////////////////////////////////////////////// // Usage: Make sure you CREATE a backup first since it // // will be needed later on by the OBJECT CLONER. Then // // drop this script in an object you would like to // // mirror. After that, touch the script and wait till // // all the sculpts are mirrored. When the process ends // // the object will un-link and the script will die. // ////////////////////////////////////////////////////////// default { touch_start(integer num) { integer comChannel = ((integer)("0x"+llGetSubString((string)llDetectedKey(0),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF; llListen(comChannel, "", llDetectedKey(0), ""); llDialog(llDetectedKey(0), "MIRROR: The following script will mirror all the sculpt maps in an object after which it will un-link the object and the script will die.Please confirm that you wish to proceed with the operations.", [ "[ Confirm ]", "[ Reject ]" ], comChannel); } listen(integer channel, string name, key id, string message) { if(message == "[ Confirm ]") { state rename; } } } state rename { state_entry() { integer itra=llGetNumberOfPrims(); do { llSetLinkPrimitiveParamsFast(itra, [PRIM_NAME, (string)itra]); } while(--itra>0); state mirror; } } state mirror { state_entry() { integer itra=llGetNumberOfPrims(); do { list lType = llGetLinkPrimitiveParams(itra, [PRIM_TYPE]); if(llList2Integer(lType, 0) == PRIM_TYPE_SCULPT) { llSetLinkPrimitiveParamsFast(itra, [PRIM_TYPE, llList2Integer(lType, 0), llList2Key(lType, 1), llList2Integer(lType, 2) | PRIM_SCULPT_FLAG_MIRROR]); } } while(--itra>0); state modify; } } state modify { state_entry() { llOwnerSay("MIRROR: Job done... Please make any changes to the primitives and then touch me again to unlink the object."); } touch_start(integer num) { llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS); } run_time_permissions(integer perm) { if(perm & PERMISSION_CHANGE_LINKS) { state unlink; } } } state unlink { state_entry() { integer itra=llGetNumberOfPrims(); do { llBreakLink(itra); } while(--itra>0); llOwnerSay("MIRROR: Please pick-up your objects one by one and refer to the cloner script, kthxbye!"); llRemoveInventory(llGetScriptName()); } }