////////////////////////////////////////////////////////// // (C) Wizardry and Steamworks - 2011, License: GPLv3 // // // // -* OBJECT CLONER *- // // // ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // About: Mirrors all the sculpts in a link-set. // ////////////////////////////////////////////////////////// // Usage: Once you have picked up all the objects from // // the object crushed by OBJECT MIRROR, rez the linked // // object again and gently drop all the little pieces // // inside the new object. After that, add this script // // and touch it once to use the wizard. // ////////////////////////////////////////////////////////// default { state_entry() { state rename; } } state rename { state_entry() { integer itra=llGetNumberOfPrims(); do { llSetLinkPrimitiveParamsFast(itra, [PRIM_NAME, (string)itra]); } while(--itra>0); state axes; } } state axes { touch_start(integer num) { integer comChannel = ((integer)("0x"+llGetSubString((string)llDetectedKey(0),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF; llListen(comChannel, "", llDetectedKey(0), ""); llDialog(llDetectedKey(0), "CLONER: Suppose that the object O represent the object, please select the most sensible axis to on which the object will be cloned. You can see the axes by right clicking the object and selecting edit.", [ "[ X ]", "[ Y ]", "[ Z ]" ], comChannel); } listen(integer channel, string name, key id, string message) { if(message == "[ X ]") { state x; } if(message == "[ Y ]") { state y; } if(message == "[ Z ]") { state z; } } } state x { state_entry() { integer itra=llGetNumberOfPrims(); do { list scratch = llParseString2List(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_POSITION]), 0), ["<", ",", ">"], []); vector vPos = ZERO_VECTOR; vPos.x = llList2Float(scratch, 0); vPos.y = llList2Float(scratch, 1); vPos.z = llList2Float(scratch, 2); scratch = llParseString2List(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_ROTATION]), 0), ["<", ",", ">"], []); rotation vRot = ZERO_ROTATION; vRot.x = llList2Float(scratch, 0); vRot.y = llList2Float(scratch, 1); vRot.z = llList2Float(scratch, 2); vRot.s = llList2Float(scratch, 3); vector rPos = llGetRootPosition(); rPos.x += 1; float reflectX = rPos.x; float diffRefl = vPos.x - reflectX; llRezObject(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_NAME]), 0), , ZERO_VECTOR, vRot, 0); } while(--itra>0); state complete; } } state y { state_entry() { integer itra=llGetNumberOfPrims(); do { list scratch = llParseString2List(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_POSITION]), 0), ["<", ",", ">"], []); vector vPos = ZERO_VECTOR; vPos.x = llList2Float(scratch, 0); vPos.y = llList2Float(scratch, 1); vPos.z = llList2Float(scratch, 2); scratch = llParseString2List(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_ROTATION]), 0), ["<", ",", ">"], []); rotation vRot = ZERO_ROTATION; vRot.x = llList2Float(scratch, 0); vRot.y = llList2Float(scratch, 1); vRot.z = llList2Float(scratch, 2); vRot.s = llList2Float(scratch, 3); vector rPos = llGetRootPosition(); rPos.y += 1; float reflectY = rPos.y; float diffRefl = vPos.y - reflectY; llRezObject(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_NAME]), 0), , ZERO_VECTOR, vRot, 0); } while(--itra>0); state complete; } } state z { state_entry() { integer itra=llGetNumberOfPrims(); do { list scratch = llParseString2List(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_POSITION]), 0), ["<", ",", ">"], []); vector vPos = ZERO_VECTOR; vPos.x = llList2Float(scratch, 0); vPos.y = llList2Float(scratch, 1); vPos.z = llList2Float(scratch, 2); scratch = llParseString2List(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_ROTATION]), 0), ["<", ",", ">"], []); rotation vRot = ZERO_ROTATION; vRot.x = llList2Float(scratch, 0); vRot.y = llList2Float(scratch, 1); vRot.z = llList2Float(scratch, 2); vRot.s = llList2Float(scratch, 3); vector rPos = llGetRootPosition(); rPos.z += 1; float reflectZ = rPos.z; float diffRefl = vPos.z - reflectZ; llRezObject(llList2String(llGetLinkPrimitiveParams(itra, [PRIM_NAME]), 0), , ZERO_VECTOR, vRot, 0); } while(--itra>0); state complete; } } state complete { state_entry() { llRemoveInventory(llGetScriptName()); llOwnerSay("MIRROR: Job done. Kthxbye!"); } }