Prim Mirror Script Now Available!
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-08-2005 22:17
Adding the "fixed" code here. This form of the code uses existing prims and just flips them around, and does not create a "copy" at all. To use this, you MUST UNLINK YOUR OBJECT FIRST AND PLACE THE "MIRROR CODE" INTO YOUR REFERENCE OBJECT BEFORE MIRRORING.- New Year's Revision of the code added. Yay! Let me know if I broke anything.Edit: I did. Posted a fix for cylinders and prisms. Let me know if I broke anything else. //============================================================================ // Prim Mirroring Script Set // Written by Jeffrey Gomez // // Permissions Granted to Edit, Copy, Transfer, and Sell this script // to any user, so long as this comment set remains intact, and is // granted WITHOUT ANY WARRANTY. USE AT OWN RISK. And enjoy. =] // // // Original Date of Creation: March 8th, 2005 // Last Date of Revision: January 9th, 2005 // // Any unauthorized or illegal usage of this script, as dictated by // International Laws of Copyright or Linden Labs voids any license to use // this script. Creator of this script is not responsible for said use. // // So please, don't come after me. =) // // // Forum Thread URL(s): // http://forums.secondlife.com/showthread.php?t=38165 // // // Script Purpose and Usage: // This script is used to mirror prims. That's about it! // // To use this script set place the Prim Mirror Code in a second prim. // That's it! Now when you want to mirror something (relative to this second // prim), merely drop the appropriate Mirror Code into the item (primitive) // that you wish to mirror. The script will do the work for you. // // You may rotate the mirror prim around to get different angles, or scale it // to get different sizes of mirroring. Note scaling appears odd for this - // that's a factor of how prims work, so don't blame me! // // Script Limitations: // - This Script DOES NOT support Prim Torturing in ANY form. //============================================================================
//====================== Constants.Begin =====================
vector AXIS = <0,0,1>; // Defines axis to mirror (X,Y,Z). Checks Booleans only! float RANGE = 10.0; // Defines range of sensor for mirroring. string KEY = // Key value for sensor "";
string NAME = // Name value for sensor "Prim Mirror Base";
string MESSAGE = // Error message if not in range. "Hey! You need to have the mirror rezzed and nearby to use this! How else do I know what to mirror against? Touch to continue.";
//====================== Constants.End =====================
//====================== Global_Variables.Begin =====================
vector pos; // Current Prim's Position rotation rot; // Current Prim's Rotation vector size; // Current Prim's Scale integer type; // Current Prim's Prim Type integer holeshape; // Current Prim's Hollow Shape float hollow; // Current Prim's Hollow Size vector holesize; // Current Prim's Wrap Radius vector cut; // Current Prim's Cut vector twist; // Current Prim's Twist vector topsize; // Current Prim's Top Size vector topshear; // Current Prim's Top Shear vector dimple; // Current Prim's Dimple vector advancedcut; // Current Prim's Advanced Cut vector taper; // Current Prim's Taper float revolutions; // Current Prim's Number of Revolutions float radiusoffset; // Current Prim's Radius Delta float skew; // Current Prim's Skew
//====================== Global_Variables.End =====================
//====================== Global_Functions.Begin =====================
// GetParams: Fills global variable namespaces with current primitive params GetParams() { // Dump our params to a list and return ... list params = llGetPrimitiveParams([PRIM_POSITION,PRIM_ROTATION,PRIM_SIZE,PRIM_TYPE]); pos = llList2Vector(params,0); // ... position... rot = llList2Rot(params,1); // ... rotation ... size = llList2Vector(params,2); // ... scale ... type = llList2Integer(params,3); // ... type ... holeshape = llList2Integer(params,4); // ... holeshape ... cut = llList2Vector(params,5); // ... cut ... hollow = llList2Float(params,6); // ... hole amount ... twist = llList2Vector(params,7); // ... twist ... // ... and use the type to check the next series of operations if(type < 3) // If this is a box, cylinder, or prism, return ... { topsize = llList2Vector(params,8); // ... top size ... topshear = llList2Vector(params,9); // ... and top shear. } else if(type == 3) // If this is a sphere, return... { dimple = llList2Vector(params,8); // ... dimple. } else if(type > 3) // If this is a tube, torus, or ring, return ... { holesize = llList2Vector(params,8); // ... hole size ... topshear = llList2Vector(params,9); // ... top shear ... advancedcut = llList2Vector(params,10); // ... advanced cut ... taper = llList2Vector(params,11); // ... taper ... revolutions = llList2Float(params,12); // ... revolutions ... radiusoffset = llList2Float(params,13); // ... radius delta ... skew = llList2Float(params,14); // ... and skew. } }
//====================== Global_Functions.End =====================
//====================== State_Functions.Begin =====================
default { sensor(integer total_number) // Sensor_Event.begin { // Local_Variables.begin integer i; // Top level loop count integer j; // Nested loop count vector relPos; // Relative frame position rotation relRot; // Relative frame rotation vector relRot2; // Rotation as a Euler integer count = // Sums booleans for flip loops llAbs((integer)AXIS.x) + llAbs((integer)AXIS.y) + llAbs((integer)AXIS.z); // Local_Variables.end // Statements.begin GetParams(); // Calls GetParams
for(i = 0; i < total_number; ++i) // Sensor_Loop.begin { if(llDetectedGroup(i)) // Group_If.begin { // Gets position relative to mirror relPos = (pos - llDetectedPos(i)) / llDetectedRot(i); // Gets rotation relative to mirror relRot = rot / llDetectedRot(i); // Stores this rotation as a Euler relRot2 = llRot2Euler(relRot); // Box, Cylinder, Prism: if(type < 3) { for(j = 0; j < count; ++j) // Nest_Loop.begin { // Flips stuff based on number of times mirroring cut = <1 - cut.y, 1 - cut.x, 0>; topshear = <topshear.y,topshear.x,0>; topsize = <topsize.y,topsize.x,0>; twist *= -1; size = <size.y,size.x,size.z>; } // Nest_Loop.end if(AXIS.x) // If X Axis option is set... { relPos.x *= -1; relRot2.y *= -1; relRot2.z *= -1; relRot2 = llRot2Euler(<0.00000, 0.00000, 0.70711, 0.70711> * llEuler2Rot(relRot2)); } if(AXIS.y) // If Y Axis option is set... { relPos.y *= -1; relRot2.x *= -1; relRot2.z *= -1; relRot2 = llRot2Euler(<0.00000, 0.00000, -0.70711, 0.70711> * llEuler2Rot(relRot2)); } if(AXIS.z) // If Z Axis option is set... { relPos.z *= -1; relRot2.x *= -1; relRot2.y *= -1; relRot2 = llRot2Euler(<-0.70711, -0.70711, -0.00000, 0.00000> * llEuler2Rot(relRot2)); } if(type == 2 || type == 1) // If this is a cylinder or prism: { for(j = 0; j < count; ++j) // Nest_Loop.begin { topshear = <topshear.y,-1 * topshear.x,0>; topsize = <topsize.y,topsize.x,0>; relRot2.z += PI_BY_TWO; size = <size.y,size.x,size.z>; } // Nest_Loop.end } } // Sphere: else if(type == 3) { for(j = 0; j < count; ++j) // Nest_Loop.begin { cut = <1 - cut.y, 1 - cut.x, 0>; twist = <twist.y,twist.x,0>; } // Nest_Loop.end if(AXIS.x) // If X Axis option is set... { relPos.x *= -1; relRot2.z *= -1; relRot2.y *= -1; relRot2 = llRot2Euler(<-0.00000, -1.00000, -0.00000, 0.00000> * llEuler2Rot(relRot2)); } if(AXIS.y) // If Y Axis option is set... { relPos.y *= -1; relRot2.x *= -1; relRot2.z *= -1; relRot2 = llRot2Euler(<1.00000, -0.00000, -0.00000, 0.00000> * llEuler2Rot(relRot2)); } if(AXIS.z) // If Z Axis option is set... { relPos.z *= -1; relRot2.x *= -1; relRot2.y *= -1; } } // Torus, tube, ring: else if(type > 3) { for(j = 0; j < count; ++j) // Nest_Loop.begin { cut = <1 - cut.y, 1 - cut.x, 0>; twist = <twist.y,twist.x,0>; topshear = <topshear.x * -1,topshear.y * -1,0>; taper *= -1; radiusoffset *= -1; skew *= -1; } // Nest_Loop.end if(AXIS.x) // If X Axis option is set... { relPos.x *= -1; relRot2.y *= -1; relRot2.y += PI; } if(AXIS.y) // If Y Axis option is set... { relPos.y *= -1; relRot2.x *= -1; relRot2.x += PI; relRot2.y *= -1; } if(AXIS.z) // If Z Axis option is set... { relPos.z *= -1; relRot2.x *= -1; relRot2 += <PI,PI,PI>; } } // Set back the relative rotation relRot = llEuler2Rot(relRot2); // Set the sim-level position pos = llDetectedPos(i) + (relPos * llDetectedRot(i)); // Set the sim-level rotation rot = relRot * llDetectedRot(i); // Uncomment for items exceeding 10m // NOTE you may need to take globals into account! //while(llGetPos() != pos) //llSetPos(pos); if(type < 3) // Box, Cylinder, Prism: { llSetPrimitiveParams([PRIM_POSITION,pos,PRIM_ROTATION,rot,PRIM_SIZE,size,PRIM_TYPE,type,holeshape,cut,hollow,twist,topsize,topshear]); } else if(type == 3) // Sphere: { llSetPrimitiveParams([PRIM_POSITION,pos,PRIM_ROTATION,rot,PRIM_SIZE,size,PRIM_TYPE,type,holeshape,cut,hollow,twist,dimple]); } else if(type > 3) // Tube, Torus, Ring: { llSetPrimitiveParams([PRIM_POSITION,pos,PRIM_ROTATION,rot,PRIM_SIZE,size,PRIM_TYPE,type,holeshape,cut,hollow,twist,holesize,topshear,advancedcut,taper,revolutions,radiusoffset,skew]); } // If we got here, remove this script from inventory llRemoveInventory(llGetScriptName()); // Statements.end } // Group_If.end } // Sensor_Loop.end } // Sensor_Event.end state_entry() // Always called at start of script { llSensor(NAME,KEY,ACTIVE | PASSIVE, RANGE, TWO_PI); // Call sensor } touch_start(integer total_number) // Frustration mode catcher { llSensor(NAME,KEY,ACTIVE | PASSIVE, RANGE, TWO_PI); // Call sensor } no_sensor() // Called if mirror not in range { llOwnerSay(MESSAGE); // If not found, send the owner a cute little message } }
//====================== State_Functions.End =====================
// Great stuff, yeah? And the new code for the mirror prim itself! default { state_entry() { llSetObjectName("Prim Mirror Base"); // T'ain't much here, McGee. } } No, I'm not kidding. It needed that much of a cleanup job.
_____________________
---
|
Alex Lumiere
Registered User
Join date: 1 Jun 2004
Posts: 228
|
03-12-2005 09:02
Original Thread: /15/9a/38165/1.html, ne awesome! thank you 
|
Storma Amarula
Registered User
Join date: 8 Mar 2005
Posts: 87
|
03-17-2005 11:53
Thanks so much Jeffrey - a very useful Prim building tool!
|
Shiryu Musashi
Veteran Designer
Join date: 19 Nov 2004
Posts: 1,045
|
03-19-2005 06:16
mmmh let me understand, so this script allows you to copy any prim made item (textures excluded) even if it's no-copy?
|
Shiryu Musashi
Veteran Designer
Join date: 19 Nov 2004
Posts: 1,045
|
03-19-2005 06:18
let me understand, does this tool help you copy an item's prims (but not textures) even when it's no-copy?
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
03-19-2005 16:57
It will mirror anything that is flagged "Modify" and was created by the owner of the item. Trust me - I had a nice long thread on the "potential to abuse" already, asked a few residents, and even talked to a few Lindens prior to release. Please don't hurt me. 
_____________________
---
|
Unhygienix Gullwing
I banged Pandastrong
Join date: 26 Jun 2004
Posts: 728
|
03-20-2005 15:01
All objects suddenly forced into open-source domain?
|
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
|
03-21-2005 00:17
yes Shiriu its why i was a bit opposed to the idea
_____________________
 tired of XStreetSL? try those! apez http://tinyurl.com/yfm9d5b metalife http://tinyurl.com/yzm3yvw metaverse exchange http://tinyurl.com/yzh7j4a slapt http://tinyurl.com/yfqah9u
|
Michi Lumin
Sharp and Pointy
Join date: 14 Oct 2003
Posts: 1,793
|
03-22-2005 09:56
Yes... Others have existed, but they were not disrtributed for this reason...
I'm sure this falls into one of the "This can be used for good or bad, and the creator isn't responsible if it's used for bad" areas, but especially since the script is now publically available, yes, copies of nocopy will become quite a bit more common.
|
Michi Lumin
Sharp and Pointy
Join date: 14 Oct 2003
Posts: 1,793
|
03-22-2005 10:04
Really, what I want to know, is when people do start copying and selling other folk's stuff with this thing, what is LL going to do about it - I'd imagine a big fat nothing.
|
Lordfly Digeridoo
Prim Orchestrator
Join date: 21 Jul 2003
Posts: 3,628
|
03-22-2005 10:18
Who needs perm settings when you can just copy everything with this script?
IP rights go foom....
_____________________
---- http://www.lordfly.com/ http://www.twitter.com/lordfly http://www.plurk.com/lordfly
|
eltee Statosky
Luskie
Join date: 23 Sep 2003
Posts: 1,258
|
03-22-2005 10:30
Yes this is a very useful script, but it could be used to duplicate in world items that would otherwise be set no copy.
_____________________
wash, rinse, repeat
|
shinmai Akebono
Registered User
Join date: 9 Jul 2004
Posts: 49
|
03-22-2005 21:23
I believe it is scripted to check if you created the object before it allows you to mirror it.
|
YadNi Monde
Junkyard Owner
Join date: 30 Mar 2004
Posts: 189
|
03-25-2005 10:31
Yes Shinmai, it DOES check if you are the Creator of the Original Prim you want to mirror, but it s also probably true that as the script is open source bad things can happen, cause u ll always have "unpolite terms"people everywhere =D
_____________________
---------------=If It S Not Primmy It S Not A YadNi=---------------- -=In a MMORPG u levelup a Character, in SL u levelup the User.=- ----------------=Your only limit is Your imagination.=-------------- -------------------------------------------  Yours, Friendly, Yadni =) 
|
YadNi Monde
Junkyard Owner
Join date: 30 Mar 2004
Posts: 189
|
03-25-2005 10:33
Yes Shinmai, it does check that you are the creator of the original prim to mirror, but it is true too that as the script is open source, it can be used in bad ways.......
_____________________
---------------=If It S Not Primmy It S Not A YadNi=---------------- -=In a MMORPG u levelup a Character, in SL u levelup the User.=- ----------------=Your only limit is Your imagination.=-------------- -------------------------------------------  Yours, Friendly, Yadni =) 
|
Rico Plisskin
Registered User
Join date: 17 Feb 2005
Posts: 104
|
04-16-2005 07:10
If it detects that you are the owner and works for the owner (which means your personal objects and such are all full perm) then cant you just click and drag the object from inventory for duplication without messing up textures or anything?
|
Juro Kothari
Like a dog on a bone
Join date: 4 Sep 2003
Posts: 4,418
|
04-23-2005 17:58
How does this affect transfer? Say, for example, I have an object that is copy/mod/no trans, will it now become copy/mod/trans?
|
Nexus Nash
Undercover Linden
Join date: 18 Dec 2002
Posts: 1,084
|
04-23-2005 23:30
This is simply a ghoster.
99% of people who sell stuff of VALUE have inventory such as scripts that are either no copy, no mod, no trans.... usually under the flags mod, no copy, trans or no mod,copy, no trans.
Under these 2 sets of perms there is NO way to fully copy say... a scripted ANYTHING. You might be able to get the model, of the thing, but the guts (the hard part to make) (scripts) you won't be able to touch.
So, nice prim copier, pretty much usless from a "i'm gonna copy all your stuff and sell them as mine" stand point.
P.S. Why is everyone freaking out?! You can't copy anything 100% if it has inventory.
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
04-24-2005 20:37
From: Nexus Nash So, nice prim copier, pretty much usless from a "i'm gonna copy all your stuff and sell them as mine" stand point. The original intended use was nothing of this sort - I could show you exactly what it's meant to do in-world. From: Nexus Nash P.S. Why is everyone freaking out?! You can't copy anything 100% if it has inventory. Because the community at large (well, the vocal minority at least) is apparently not ready for this stuff in an open environment. I took this down because it earnestly distressed a single resident - that's enough of a message for me. "Drama threads" are typically nothing more than just that, however. I have rewritten the script to get what was fundamentally important - the fact this can perfectly create an inverted, mirror image of an object - to work without the side effect of actually "copying" prims. I will likely release that once the seas have calmed over this issue. As an addendum, please get your facts straight before you "champion" my work. The fact you have now twice called this "just another prim copier" upsets me, because it only builds on the level of naivete that started the drama in the first place. And, in a lot of ways, I did overestimate the technical knowledge of residents over this. As they say, the road to hell is paved with good intentions. Please research the issue first.
_____________________
---
|
Thili Playfair
Registered User
Join date: 18 Aug 2004
Posts: 2,417
|
04-24-2005 21:10
So unless it has a script whatever i make has no value now? Utter BS from you No mod, or no copy on a house wich is what i make is useless , image buying a house and wont let you change anything or if you accidentally delete it , well no copy ruins that, ops, you sir a moron
|
Hiro Pendragon
bye bye f0rums!
Join date: 22 Jan 2004
Posts: 5,905
|
04-24-2005 22:42
Mmmmm .... so next are you going to be writing a virus and distributing it as "be careful with this"? 
_____________________
Hiro Pendragon ------------------ http://www.involve3d.com - Involve - Metaverse / Emerging Media Studio
Visit my SL blog: http://secondtense.blogspot.com
|
Caliandris Pendragon
Waiting in the light
Join date: 12 Feb 2004
Posts: 643
|
Because, because, because, because....
04-25-2005 01:01
From: Nexus Nash P.S. Why is everyone freaking out?! You can't copy anything 100% if it has inventory. I make frames and mirrors and jars and rugs and jugs and benches and tables and boxes and paintings and LOADS of stuff that has no scripts. I already know that people are selling my free to copy stuff, and that's bad enough. Knowing that they are selling the stuff I spent time designing would be very depressing. Some of us don't have amazing scripting skills, and some of us make items that wouldn't be scripted no matter how amazing a scripter we were. That's why. Cali
|
Caliandris Pendragon
Waiting in the light
Join date: 12 Feb 2004
Posts: 643
|
My previous posting on this thread vanished
04-25-2005 05:24
From: Nexus Nash This is simply a ghoster.
99% of people who sell stuff of VALUE have inventory such as scripts that are either no copy, no mod, no trans.... usually under the flags mod, no copy, trans or no mod,copy, no trans.
Under these 2 sets of perms there is NO way to fully copy say... a scripted ANYTHING. You might be able to get the model, of the thing, but the guts (the hard part to make) (scripts) you won't be able to touch.
So, nice prim copier, pretty much usless from a "i'm gonna copy all your stuff and sell them as mine" stand point.
P.S. Why is everyone freaking out?! You can't copy anything 100% if it has inventory. I make lots of things which don't have inventory. I spend hours building things which I then sell. As someone has said in another thread, how would YOU feel if someone made a script duplicator which made your scripts FTC and showed someone else as the creator???? I really cannot see why anyone who had good intentions would make this Jeffrey. Cali
|
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
|
Discussion Thread
04-25-2005 08:05
_____________________
i've got nothing. 
|
Soldeus Stygian
Registered User
Join date: 1 Sep 2004
Posts: 19
|
06-29-2005 06:39
Woo! thanks for posting this script. Have been trying to figure out for ages how to mirror a curved torus. Worked perfectly for what i needed it for 
|