Building helpers · IntermediateArrange exhibits facing an arc center
Print positions and inward-facing yaw values along an arc.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set radius, sweep and count2..12. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Assumes each exhibit faces local+X; a mesh modeled along another axis needs an additional offset.
// Original Incoprea. MIT. Planning only.
float RADIUS=5.0;
float SWEEP=150.0;
integer COUNT=7;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RADIUS<=0.0||COUNT<2||COUNT>12)
{
llOwnerSay("Invalid radius/count.");
return;
}
integer i;
for(i=0;i<COUNT;++i)
{
float degrees=-SWEEP*0.5+SWEEP*(float)i/(COUNT-1);
float a=degrees*DEG_TO_RAD;
llOwnerSay("Position="+(string)<RADIUS*llCos(a),RADIUS*llSin(a),0.0>+" inward yaw="+(string)(degrees+180.0));
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateAudit active point lights in a build
List enabled point lights and report how many the linkset contains.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded.
Stop / restore: Remove or disable. This inspector changes no build properties.
Does not turn lights off or alter materials. Viewer light limits and graphics settings determine what is visible; this is a configuration inventory.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
integer i;
integer active;
for(i=1;i<=total;++i)
{
list light=llGetLinkPrimitiveParams(i,[PRIM_POINT_LIGHT]);
if(llList2Integer(light,0))
{
++active;
llOwnerSay("Light "+(string)i+" "+llGetLinkName(i)+": intensity="+llList2String(light,2)+", radius="+llList2String(light,3));
}
}
llOwnerSay("Enabled point lights: "+(string)active);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · AdvancedAudit live diffuse-asset transitions
Watch up to32 faces and count how often each face’s diffuse asset changes during a session.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Place inside a prim running a slideshow or texture selector. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
Observes texture UUID changes only, not UV animation, pixel changes or PBR assets. Fast intermediate swaps can be missed.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
list assets;
list counts;
integer faces;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
integer i;
for(i=0;i<faces;++i)llOwnerSay("Face "+(string)i+" observed asset transitions="+(string)llList2Integer(counts,i));
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
faces=llGetNumberOfSides();
if(faces>32)return;
assets=[];
counts=[];
integer i;
for(i=0;i<faces;++i)
{
assets += [llList2String(llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TEXTURE,i]),0)];
counts += [0];
}
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
if(llGetNumberOfSides()!=faces)
{
llOwnerSay("Face count changed; ending session.");
finish();
return;
}
integer i;
for(i=0;i<faces;++i)
{
string asset=llList2String(llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TEXTURE,i]),0);
if(asset!=llList2String(assets,i))
{
assets=llListReplaceList(assets,[asset],i,i);
counts=llListReplaceList(counts,[llList2Integer(counts,i)+1],i,i);
}
}
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5 · API reference 6
Building helpers · IntermediateAverage four measured feature positions
Calculate a four-point centroid and maximum sample distance from it.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch four landmarks on the same object/linkset. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
All samples have equal weight; this is not a volume or mass centroid. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector centre=(a+b+c+d)*0.25;
float maximum;
integer i;
for(i=0;i<4;++i)
{
float distance=llVecDist(centre,llList2Vector(points,i));
if(distance>maximum)maximum=distance;
}
llOwnerSay("Sample centroid="+(string)centre+" maximum sample radius="+(string)maximum);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateBalance alternating items across two rows
Split a sequence into two rows while centering each row independently.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set COUNT1..16 and spacing. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Odd totals produce one longer row; centering avoids an unintended half-cell shift.
// Original Incoprea. MIT. Planning only.
integer COUNT=9;
float SPACING=1.0;
float ROW_GAP=1.5;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(COUNT<1||COUNT>16||SPACING<=0.0)
{
llOwnerSay("Invalid count/spacing.");
return;
}
integer i;
for(i=0;i<COUNT;++i)
{
integer row=i%2;
integer column=i/2;
integer rowCount=COUNT/2;
if(row==0)rowCount=(COUNT+1)/2;
float x=(column-(rowCount-1)*0.5)*SPACING;
llOwnerSay((string)i+": "+(string)<x,row*ROW_GAP,0.0>);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · BeginnerBox material estimator
Calculate the volume and surface area of a full rectangular box from its scale.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use an uncut solid box and touch as owner.
Stop / restore: Remove or disable the script. It does not change the build.
This is a mathematical box estimate, not mesh volume, physics volume, land impact, or a material-price quote. Hollow and cut prims are not accounted for.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
vector s = llGetScale();
float volume = s.x * s.y * s.z;
float area = 2.0 * (s.x*s.y + s.x*s.z + s.y*s.z);
llOwnerSay("Full-box volume: " + (string)volume + " cubic meters.");
llOwnerSay("Full-box surface area: " + (string)area + " square meters.");
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateBridge between two build anchors
Calculate a beam’s center, length and rotation so its localX points from one anchor to another.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set endpoints A/B and choose a beam modeled along localX. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Rotation uses the shortest alignment; roll around the beam is not independently controlled.
// Original Incoprea. MIT. Calculation only.
vector A=<2.0,3.0,1.0>;
vector B=<8.0,7.0,4.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
vector delta=B-A;
float length=llVecMag(delta);
if(length<0.000001)
{
llOwnerSay("Anchors coincide.");
return;
}
rotation r=llRotBetween(<1.0,0.0,0.0>,delta/length);
llOwnerSay("Centre="+(string)((A+B)*0.5)+" length="+(string)length+" rotation="+(string)r);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCalculate a connecting-rod slider position
Evaluate slider position and connecting rod angle for a crank and longer rod.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set rod length greater than crank radius and crank angle degrees. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Ideal planar slider-crank; no offsets or joint thickness. This complements visual crank models with exact position math.
// Original Incoprea. MIT. Planning only.
float CRANK=1.0;
float ROD=3.0;
float ANGLE=60.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(CRANK<=0.0||ROD<=CRANK)
{
llOwnerSay("Need rod>crank>0.");
return;
}
float a=ANGLE*DEG_TO_RAD;
float y=CRANK*llSin(a);
float x=CRANK*llCos(a)+llSqrt(ROD*ROD-y*y);
llOwnerSay("SliderX="+(string)x+" rod angle degrees="+(string)(llAsin(-y/ROD)*RAD_TO_DEG));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateCalculate a corner-rounded platform
Calculate area and perimeter of a rectangle with four equal quarter-circle corners.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set width/height and radius no greater than half the smaller dimension. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Ideal outline only; no geometry or collision shape is generated.
// Original Incoprea. MIT. Calculation only.
float W=8.0;
float H=5.0;
float R=0.8;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(W<=0.0||H<=0.0||R<0.0||2.0*R>W||2.0*R>H)
{
llOwnerSay("Radius does not fit.");
return;
}
llOwnerSay("Area="+(string)(W*H-(4.0-PI)*R*R)+" perimeter="+(string)(2.0*(W+H)-8.0*R+TWO_PI*R));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCalculate a frame aperture with mat borders
Calculate visible opening and outer frame size around an artwork.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set image width/height, overlap, mat width and frame width. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Overlap must leave positive visible image dimensions; borders are symmetric.
// Original Incoprea. MIT. Calculation only.
float IMAGE_W=2.0;
float IMAGE_H=1.4;
float OVERLAP=0.02;
float MAT=0.15;
float FRAME=0.08;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(IMAGE_W<=2.0*OVERLAP||IMAGE_H<=2.0*OVERLAP||OVERLAP<0.0||MAT<0.0||FRAME<0.0)
{
llOwnerSay("Invalid frame inputs.");
return;
}
float apertureW=IMAGE_W-2.0*OVERLAP;
float apertureH=IMAGE_H-2.0*OVERLAP;
llOwnerSay("Aperture="+(string)<apertureW,apertureH,0.0>+" outer="+(string)<apertureW+2.0*(MAT+FRAME),apertureH+2.0*(MAT+FRAME),0.0>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCalculate matching gear pitch dimensions
Translate module and tooth counts into pitch diameters and center separation.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive MODULE and tooth counts at least8. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Ideal spur-gear pitch geometry, not a printable tooth profile or structural design.
// Original Incoprea. MIT. Planning only.
float MODULE=0.1;
integer TEETH_A=24;
integer TEETH_B=36;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(MODULE<=0.0||TEETH_A<8||TEETH_B<8)
{
llOwnerSay("Invalid module/tooth counts.");
return;
}
float da=MODULE*TEETH_A;
float db=MODULE*TEETH_B;
llOwnerSay("Pitch diameters="+(string)da+","+(string)db+" center spacing="+(string)((da+db)*0.5)+" output/input speed="+(string)(-(float)TEETH_A/(float)TEETH_B));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · AdvancedCapture a child’s local animation bounds
Record local position minima and maxima for the child containing this script.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Put in an animated child; start by touching that child. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
Root movement does not affect the local envelope. Stops if the script prim ceases to be a child; no animation is changed.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
vector low;
vector high;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
llOwnerSay("Observed child local envelope min="+(string)low+" max="+(string)high+" span="+(string)(high-low));
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
if(llGetLinkNumber()<2)
{
llOwnerSay("Use a linked child.");
return;
}
low=llGetLocalPos();
high=low;
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
if(llGetLinkNumber()<2)
{
finish();
return;
}
vector p=llGetLocalPos();
if(p.x<low.x)low.x=p.x;
if(p.y<low.y)low.y=p.y;
if(p.z<low.z)low.z=p.z;
if(p.x>high.x)high.x=p.x;
if(p.y>high.y)high.y=p.y;
if(p.z>high.z)high.z=p.z;
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · AdvancedCenter a child between two named anchors
Place the selected child center halfway between two uniquely named child markers.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Name two other children anchor_a and anchor_b. Owner-touch the child to preview; touch again to restore.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Copies only their midpoint. Both anchors must be distinct from the selected part; no root or avatar anchors.
// Original Incoprea. MIT. Test on a spare copy first.
integer selected;
key identity;
list original;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
if(selected)
{
if(llGetLinkKey(selected)==identity)llSetLinkPrimitiveParamsFast(selected,[PRIM_POS_LOCAL,llList2Vector(original,0),PRIM_ROT_LOCAL,llList2Rot(original,1),PRIM_SIZE,llList2Vector(original,2)]);
else llOwnerSay("Topology changed; restore manually from backup.");
selected=0;
return;
}
integer link=llDetectedLinkNumber(0);
if(link<2||link>llGetObjectPrimCount(llGetKey()))
{
llOwnerSay("Touch a child prim.");
return;
}
list data=llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL,PRIM_SIZE]);
vector p=llList2Vector(data,0);
rotation r=llList2Rot(data,1);
vector size=llList2Vector(data,2);
integer i;
integer a;
integer b;
integer ca;
integer cb;
integer total=llGetObjectPrimCount(llGetKey());
if(total>32)return;
for(i=2;i<=total;++i)
{
if(llGetLinkName(i)=="anchor_a")
{
a=i;
++ca;
}
if(llGetLinkName(i)=="anchor_b")
{
b=i;
++cb;
}
}
if(ca!=1||cb!=1||a==link||b==link)
{
llOwnerSay("Need two unique other anchor children.");
return;
}
p=(llList2Vector(llGetLinkPrimitiveParams(a,[PRIM_POS_LOCAL]),0)+llList2Vector(llGetLinkPrimitiveParams(b,[PRIM_POS_LOCAL]),0))*0.5;
selected=link;
identity=llGetLinkKey(link);
original=data;
llSetLinkPrimitiveParamsFast(link,[PRIM_POS_LOCAL,p,PRIM_ROT_LOCAL,r,PRIM_SIZE,size]);
llOwnerSay("Preview applied; touch again to restore.");
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCenter a gallery grid inside a wall
Calculate centered artwork positions from item dimensions, gaps and a row/column count.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set wall dimensions and artwork grid inputs; total items at most16. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Rejects a grid that exceeds the wall; all works are assumed equal-sized.
// Original Incoprea. MIT. Planning only.
float WALL_W=10.0;
float WALL_H=5.0;
float ITEM_W=2.0;
float ITEM_H=1.2;
float GAP_X=0.5;
float GAP_Y=0.4;
integer COLUMNS=3;
integer ROWS=2;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(COLUMNS<1||ROWS<1||COLUMNS*ROWS>16||ITEM_W<=0.0||ITEM_H<=0.0||GAP_X<0.0||GAP_Y<0.0)
{
llOwnerSay("Invalid grid.");
return;
}
float width=COLUMNS*ITEM_W+(COLUMNS-1)*GAP_X;
float height=ROWS*ITEM_H+(ROWS-1)*GAP_Y;
if(width>WALL_W||height>WALL_H)
{
llOwnerSay("Grid does not fit wall.");
return;
}
integer row;
integer col;
for(row=0;row<ROWS;++row)for(col=0;col<COLUMNS;++col)llOwnerSay((string)<-width*0.5+ITEM_W*0.5+col*(ITEM_W+GAP_X),0.0,-height*0.5+ITEM_H*0.5+row*(ITEM_H+GAP_Y)>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCenter child on named part
Preview a child centered on one uniquely named linked reference.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Name another child reference_center. Use nonphysical moving child. Touch again restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Copies position only. Overlap intentional.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
vector home;
default
{
state_entry()
{
home=llGetLocalPos();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS))return;
preview=!preview;
if(preview)
{
integer i;
integer target;
integer count;
for(i=2;i<=llGetNumberOfPrims();++i)if(i!=llGetLinkNumber()&&llGetLinkName(i)=="reference_center")
{
target=i;
++count;
}
if(count!=1)
{
preview=FALSE;
llOwnerSay("Need one other reference_center child.");
return;
}
vector p=llList2Vector(llGetLinkPrimitiveParams(target,[PRIM_POS_LOCAL]),0);
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,p]);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,home]);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCheck a four-corner frame for squareness
Compare opposite sides and diagonals of four sampled frame corners.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch corners in boundary order. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Equal diagonals alone do not prove a rectangle; the full side/diagonal report helps diagnose the shape. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
llOwnerSay("Opposite side differences="+(string)llFabs(llVecDist(a,b)-llVecDist(c,d))+","+(string)llFabs(llVecDist(b,c)-llVecDist(d,a)));
llOwnerSay("Diagonal difference="+(string)llFabs(llVecDist(a,c)-llVecDist(b,d)));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateCheck a planned polygon for consistent turns
Inspect consecutive edge cross products for mixed turn directions.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set ordered XY VERTICES, at least3. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Consistent turns are a convexity indicator for a simple polygon; this alone does not rule out every self-intersection or repeated vertex.
// Original Incoprea. MIT. Planning only.
list VERTICES=[<0.0,0.0,0.0>,<4.0,0.0,0.0>,<2.0,1.0,0.0>,<4.0,4.0,0.0>,<0.0,4.0,0.0>];
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(VERTICES);
if(n<3)
{
llOwnerSay("Need three vertices.");
return;
}
integer positive;
integer negative;
integer i;
for(i=0;i<n;++i)
{
vector a=llList2Vector(VERTICES,(i+1)%n)-llList2Vector(VERTICES,i);
vector b=llList2Vector(VERTICES,(i+2)%n)-llList2Vector(VERTICES,(i+1)%n);
float cross=a.x*b.y-a.y*b.x;
if(cross>0.000001)positive=TRUE;
if(cross< -0.000001)negative=TRUE;
}
llOwnerSay("Mixed turns/concavity="+(string)(positive&&negative)+" all collinear="+(string)(!positive&&!negative));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCheck a prim Description budget
Report ASCII-only and forbidden-pipe findings before using Description as configuration.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in the prim and touch as owner.
Stop / restore: Remove or disable. This inspector changes no build properties.
Second Life Description is limited to 127 bytes and printable ASCII excluding pipe. This examines the stored value, which may already have been normalized or truncated.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
string description=llGetObjectDesc();
integer issues;
integer i;
for(i=0;i<llStringLength(description);++i)
{
integer code=llOrd(description,i);
if(code<32 || code>126 || code==124) ++issues;
}
llOwnerSay("Stored length: "+(string)llStringLength(description)+"; nonpermitted-character findings: "+(string)issues);
if(llStringLength(description)>127) llOwnerSay("Exceeds the documented 127-byte ASCII budget.");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCheck a radial component layout
Compare horizontal root-local child distances against a planned radius.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set RADIUS and TOLERANCE. Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Ignores Z height and does not infer a mesh’s visual center. A radial layout can legitimately contain off-ring components such as a hub.
// Original Incoprea example. MIT.
float RADIUS=3.0;
float TOLERANCE=0.05;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
if(RADIUS<0 || TOLERANCE<0)
{
llOwnerSay("Use nonnegative radius and tolerance.");
return;
}
integer i;
for(i=2;i<=total;++i)
{
vector p=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
float radius=llSqrt(p.x*p.x+p.y*p.y);
if(llFabs(radius-RADIUS)>TOLERANCE)llOwnerSay("Link "+(string)i+" radius="+(string)radius+" m");
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCheck a turned rectangle inside a frame
Calculate axis-aligned extents of a rotated rectangular artwork and compare with an opening.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive artwork width/height, frame width/height and yaw. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Tests the bounding rectangle at the chosen rotation; no search for the best angle is performed.
// Original Incoprea. MIT. Planning only.
float W=3.0;
float H=2.0;
float FRAME_W=4.0;
float FRAME_H=3.0;
float ANGLE=25.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(W<=0.0||H<=0.0||FRAME_W<=0.0||FRAME_H<=0.0)
{
llOwnerSay("Positive dimensions required.");
return;
}
float a=ANGLE*DEG_TO_RAD;
float width=llFabs(W*llCos(a))+llFabs(H*llSin(a));
float height=llFabs(W*llSin(a))+llFabs(H*llCos(a));
llOwnerSay("Turned bounds="+(string)<width,height,0.0>+" fits="+(string)(width<=FRAME_W&&height<=FRAME_H));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateCheck child centers against a local plane
Find child prim centers that do not share a configured root-local Z level.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set LEVEL and TOLERANCE. Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Checks centers only, not bottoms or mesh vertices. The plane rotates with the root; it is not necessarily horizontal in the region.
// Original Incoprea example. MIT.
float LEVEL=0.0;
float TOLERANCE=0.01;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
if(TOLERANCE<0)
{
llOwnerSay("Tolerance cannot be negative.");
return;
}
integer i;
for(i=2;i<=total;++i)
{
vector position=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
if(llFabs(position.z-LEVEL)>TOLERANCE)llOwnerSay("Link "+(string)i+" local Z="+(string)position.z+" differs from level "+(string)LEVEL);
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCheck component scales against a reference
Compare prim scales to a configured reference scale within a tolerance.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set REFERENCE and TOLERANCE. Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Compares scale settings, not visible geometry. Useful for a set of intended identical modules; intentionally varied parts will be reported.
// Original Incoprea example. MIT.
vector REFERENCE=<1,1,1>;
float TOLERANCE=0.001;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
if(TOLERANCE<0)
{
llOwnerSay("Tolerance cannot be negative.");
return;
}
integer i;
integer findings;
for(i=1;i<=total;++i)
{
vector size=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_SIZE]),0);
if(llVecDist(size,REFERENCE)>TOLERANCE)
{
++findings;
llOwnerSay("Scale differs at "+(string)i+": "+(string)size);
}
}
llOwnerSay("Findings: "+(string)findings);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCheck parallelism of two sampled edges
Measure the smaller direction angle and start-to-line offset between two clicked edges.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch endpoints of edgeA, then endpoints of edgeB. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The angle is direction-independent; reversing an edge does not turn parallel into180 degrees. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector u=b-a;
vector v=d-c;
if(llVecMag(u)<0.000001||llVecMag(v)<0.000001)
{
llOwnerSay("Zero-length edge.");
return;
}
float dot=llFabs(llVecNorm(u)*llVecNorm(v));
if(dot>1.0)dot=1.0;
float angle=llAcos(dot)*RAD_TO_DEG;
float offset=llVecMag((c-a)%u)/llVecMag(u);
llOwnerSay("Parallelism angle="+(string)angle+" first-start offset="+(string)offset);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5 · API reference 6
Building helpers · IntermediateCheck spacing between round display bounds
Calculate the surface gap between every pair of small bounding spheres.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set alternating CENTER/RADIUS pairs, up to six spheres. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Spherical bounds are conservative for many shapes; a negative gap indicates overlapping bounds, not necessarily intersecting meshes.
// Original Incoprea. MIT. Planning only.
list BOUNDS=[<0.0,0.0,0.0>,1.0,<3.0,0.0,0.0>,1.2,<1.5,2.0,0.0>,0.8];
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(BOUNDS);
if(n%2||n>12)
{
llOwnerSay("Use at most six center/radius pairs.");
return;
}
integer i;
integer j;
for(i=0;i<n;i+=2)
{
float ri=llList2Float(BOUNDS,i+1);
if(ri<0.0)
{
llOwnerSay("Negative radius.");
return;
}
for(j=i+2;j<n;j+=2)
{
float rj=llList2Float(BOUNDS,j+1);
if(rj<0.0)
{
llOwnerSay("Negative radius.");
return;
}
float gap=llVecDist(llList2Vector(BOUNDS,i),llList2Vector(BOUNDS,j))-ri-rj;
llOwnerSay("Pair "+(string)(i/2)+"/"+(string)(j/2)+" gap="+(string)gap);
}
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCheck vertical overlap in a spiral stair plan
Calculate angular step and rise per revolution from a planned step count and total rise.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set step count, total turns and total rise positive. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Rise per revolution is a geometric clearance indicator only; it excludes tread thickness and avatar collision dimensions.
// Original Incoprea. MIT. Calculation only.
integer STEPS=24;
float TURNS=1.5;
float RISE=6.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(STEPS<1||TURNS<=0.0||RISE<=0.0)
{
llOwnerSay("Positive inputs required.");
return;
}
llOwnerSay("Angle per step="+(string)(360.0*TURNS/STEPS)+" rise per step="+(string)(RISE/STEPS)+" vertical rise per revolution="+(string)(RISE/TURNS));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCheck whether bounds surround the root
Compare the local bounding-box center with the root origin.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed object without seated avatars. Touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
The physical bounds center is not necessarily a visual or mass center. This helps explain why a rotation can look offset, without deciding the correct artistic pivot.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed object.");
return;
}
list b=llGetBoundingBox(llGetKey());
if(llGetListLength(b)!=2)
{
llOwnerSay("Bounds unavailable.");
return;
}
vector center=(llList2Vector(b,0)+llList2Vector(b,1))*0.5;
llOwnerSay("Bounds center relative to root: "+(string)center);
llOwnerSay("Root-to-bounds-center distance: "+(string)llVecMag(center)+" m");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCheck whether links were reordered
Record linked prim keys, then compare link positions on subsequent touches.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded.
Stop / restore: Remove or disable. This inspector changes no build properties.
Snapshot persists only until reset. Relinking can reorder keys; this check reports topology changes without identifying avatars.
// Original Incoprea example. MIT.
list prior;
integer ready;
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
list current=[];
integer i;
for(i=1;i<=total;++i) current += [llGetLinkKey(i)];
if(!ready)
{
prior=current;
ready=TRUE;
llOwnerSay("Topology snapshot recorded.");
return;
}
if(llGetListLength(prior)!=total) llOwnerSay("Prim count changed from "+(string)llGetListLength(prior)+" to "+(string)total);
for(i=0;i<total;++i) if(llList2Key(current,i)!=llList2Key(prior,i)) llOwnerSay("Different prim at link "+(string)(i+1));
prior=current;
llOwnerSay("Topology baseline updated.");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCheck whether planned vertices share a plane
Use the first three points to form a plane and measure every point’s deviation.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set at least3 POINTS with a noncollinear first triple and nonnegative tolerance. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
A degenerate first triple is rejected rather than searching for another triple.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,0.0,0.0>,<3.0,0.0,0.0>,<0.0,3.0,0.0>,<2.0,2.0,0.02>];
float TOLERANCE=0.01;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(POINTS);
if(n<3||TOLERANCE<0.0)
{
llOwnerSay("Invalid inputs.");
return;
}
vector origin=llList2Vector(POINTS,0);
vector normal=(llList2Vector(POINTS,1)-origin)%(llList2Vector(POINTS,2)-origin);
if(llVecMag(normal)<0.000001)
{
llOwnerSay("First triple is collinear.");
return;
}
normal=llVecNorm(normal);
float maximum;
integer i;
for(i=0;i<n;++i)
{
float d=llFabs((llList2Vector(POINTS,i)-origin)*normal);
if(d>maximum)maximum=d;
}
llOwnerSay("Maximum deviation="+(string)maximum+" within tolerance="+(string)(maximum<=TOLERANCE));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · BeginnerChild prim local transform
Read a child prim’s position and rotation relative to its root.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put the script inside a child prim of a linkset and touch that child as owner.
Stop / restore: Remove or disable the script. It does not change the build.
The script refuses root and unlinked prims because their local-position semantics differ. Rotation is printed as Euler degrees for convenient editing.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
if (llGetLinkNumber() < 2)
{
llOwnerSay("Place this inside a child prim, not the root.");
return;
}
llOwnerSay("Root-local position: " + (string)llGetLocalPos());
llOwnerSay("Root-local Euler degrees: " + (string)(llRot2Euler(llGetLocalRot()) * RAD_TO_DEG));
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateChoose columns for a display board
Calculate how many minimum-width cards fit in a board and the exact equal card width.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set board width, minimum card width and gap. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Returns a layout plan, not a browser CSS setting. Count is bounded to64 and never drops below one.
// Original Incoprea. MIT. Planning only.
float WIDTH=12.0;
float MINIMUM=2.5;
float GAP=0.4;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(WIDTH<=0.0||MINIMUM<=0.0||GAP<0.0)
{
llOwnerSay("Invalid dimensions.");
return;
}
integer columns=llFloor((WIDTH+GAP)/(MINIMUM+GAP));
if(columns<1)columns=1;
if(columns>64)columns=64;
float card=(WIDTH-(columns-1)*GAP)/(float)columns;
llOwnerSay("Columns="+(string)columns+" card width="+(string)card+" pitch="+(string)(card+GAP));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · AdvancedClamp a child center to an annular work area
Keep a child’s horizontal root-local radius within a configured inner and outer boundary.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Set INNER and OUTER radii in meters. Owner-touch the child to preview; touch again to restore.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Preserves height and radial bearing. A center exactly on the axis uses +X as its defined fallback direction.
// Original Incoprea. MIT. Test on a spare copy first.
integer selected;
key identity;
list original;
float INNER=1.0;
float OUTER=3.0;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
if(selected)
{
if(llGetLinkKey(selected)==identity)llSetLinkPrimitiveParamsFast(selected,[PRIM_POS_LOCAL,llList2Vector(original,0),PRIM_ROT_LOCAL,llList2Rot(original,1),PRIM_SIZE,llList2Vector(original,2)]);
else llOwnerSay("Topology changed; restore manually from backup.");
selected=0;
return;
}
integer link=llDetectedLinkNumber(0);
if(link<2||link>llGetObjectPrimCount(llGetKey()))
{
llOwnerSay("Touch a child prim.");
return;
}
list data=llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL,PRIM_SIZE]);
vector p=llList2Vector(data,0);
rotation r=llList2Rot(data,1);
vector size=llList2Vector(data,2);
if(INNER<0.0||OUTER<INNER||OUTER>10.0)return;
vector flat=<p.x,p.y,0.0>;
float radius=llVecMag(flat);
float chosen=radius;
if(chosen<INNER)chosen=INNER;
if(chosen>OUTER)chosen=OUTER;
vector direction=<1.0,0.0,0.0>;
if(radius>0.00001)direction=flat/radius;
flat=direction*chosen;
p=<flat.x,flat.y,p.z>;
selected=link;
identity=llGetLinkKey(link);
original=data;
llSetLinkPrimitiveParamsFast(link,[PRIM_POS_LOCAL,p,PRIM_ROT_LOCAL,r,PRIM_SIZE,size]);
llOwnerSay("Preview applied; touch again to restore.");
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCompare child orientations
Report children whose local rotation differs from a chosen reference quaternion.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set REFERENCE and LIMIT_DEGREES. Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Uses quaternion angular distance, avoiding Euler wraparound errors. Does not detect whether differently authored meshes visually face the same way.
// Original Incoprea example. MIT.
rotation REFERENCE=ZERO_ROTATION;
float LIMIT_DEGREES=1.0;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
if(LIMIT_DEGREES<0 || LIMIT_DEGREES>180)
{
llOwnerSay("Angle limit must be 0-180.");
return;
}
integer i;
for(i=2;i<=total;++i)
{
rotation r=llList2Rot(llGetLinkPrimitiveParams(i,[PRIM_ROT_LOCAL]),0);
float angle=llAngleBetween(r,REFERENCE)*RAD_TO_DEG;
if(angle>LIMIT_DEGREES)llOwnerSay("Link "+(string)i+" differs by "+(string)angle+" degrees.");
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCompare fabricated dimensions with a target
Report per-axis absolute and percentage deviations from a planned size.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive TARGET and nonnegative ACTUAL dimensions plus tolerance. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
This is a numerical inspection helper; tolerances are user-selected and not manufacturing advice.
// Original Incoprea. MIT. Planning only.
vector TARGET=<4.0,2.0,1.0>;
vector ACTUAL=<4.02,1.98,1.005>;
float TOLERANCE=0.015;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(TARGET.x<=0.0||TARGET.y<=0.0||TARGET.z<=0.0||ACTUAL.x<0.0||ACTUAL.y<0.0||ACTUAL.z<0.0||TOLERANCE<0.0)
{
llOwnerSay("Invalid dimensions/tolerance.");
return;
}
vector delta=ACTUAL-TARGET;
vector percent=<100.0*delta.x/TARGET.x,100.0*delta.y/TARGET.y,100.0*delta.z/TARGET.z>;
llOwnerSay("Delta="+(string)delta+" percent="+(string)percent+" within="+(string)(llFabs(delta.x)<=TOLERANCE&&llFabs(delta.y)<=TOLERANCE&&llFabs(delta.z)<=TOLERANCE));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCompare face finish settings
Compare every face’s glow and fullbright settings to face zero.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the inspected prim and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
This checks only two legacy finish settings. Different textures, colors, PBR materials, or normals can still make faces look different.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
list reference=llGetPrimitiveParams([PRIM_GLOW,0,PRIM_FULLBRIGHT,0]);
integer face;
for(face=1;face<llGetNumberOfSides();++face)
{
list finish=llGetPrimitiveParams([PRIM_GLOW,face,PRIM_FULLBRIGHT,face]);
if(llList2Float(finish,0)!=llList2Float(reference,0) || llList2Integer(finish,1)!=llList2Integer(reference,1))llOwnerSay("Finish differs on face "+(string)face+": glow="+llList2String(finish,0)+", fullbright="+llList2String(finish,1));
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateCompare two sampled feature spans
Report the ratio between two independently clicked spans.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch endpoints of the reference span, then endpoints of the comparison span. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Spans may have different directions. The first span must have nonzero length. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float reference=llVecDist(a,b);
float measured=llVecDist(c,d);
if(reference<0.000001)
{
llOwnerSay("Reference span is zero.");
return;
}
llOwnerSay("Reference="+(string)reference+" comparison="+(string)measured+" ratio="+(string)(measured/reference));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateConvert a three-dimensional grid index
Map a flat index to XYZ cell coordinates and reconstruct the same index.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set NX/NY/NZ and INDEX; total cell count limited to1000000. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
X changes fastest, thenY, thenZ. This is useful for deterministic storage and generated layouts.
// Original Incoprea. MIT. Planning only.
integer NX=5;
integer NY=4;
integer NZ=3;
integer INDEX=37;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(NX<1||NY<1||NZ<1||NX>100||NY>100||NZ>100||INDEX<0||INDEX>=NX*NY*NZ)
{
llOwnerSay("Invalid grid/index.");
return;
}
integer x=INDEX%NX;
integer y=(INDEX/NX)%NY;
integer z=INDEX/(NX*NY);
llOwnerSay("Cell="+(string)<x,y,z>+" restored index="+(string)(x+NX*(y+NY*z)));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateConvert pinion turns into rack travel
Calculate ideal straight rack travel from gear module, tooth count and turns.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive MODULE/TEETH and signed TURNS. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Ignores backlash, tooth shape, friction and mechanical loading.
// Original Incoprea. MIT. Planning only.
float MODULE=0.08;
integer TEETH=20;
float TURNS=1.5;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(MODULE<=0.0||TEETH<1)
{
llOwnerSay("Positive module/teeth required.");
return;
}
float diameter=MODULE*TEETH;
llOwnerSay("Travel="+(string)(PI*diameter*TURNS)+" travel per tooth="+(string)(PI*MODULE));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateConvert roof pitch formats
Translate rise-per-run ratio into degrees and percentage grade.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set positive RUN_UNITS and nonnegative RISE_UNITS. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Output formats describe the same ideal slope; they do not evaluate real construction suitability.
// Original Incoprea. MIT. Calculation only.
float RISE_UNITS=5.0;
float RUN_UNITS=12.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RISE_UNITS<0.0||RUN_UNITS<=0.0)
{
llOwnerSay("Invalid rise/run.");
return;
}
llOwnerSay("Angle="+(string)(llAtan2(RISE_UNITS,RUN_UNITS)*RAD_TO_DEG)+" grade="+(string)(100.0*RISE_UNITS/RUN_UNITS)+" rise per metre="+(string)(RISE_UNITS/RUN_UNITS));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateConvert screw rotation into linear advance
Calculate lead, travel and time for an ideal multi-start lead screw.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive pitch, starts andRPM; turns may be signed. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Lead equals thread pitch times starts. This only plans a virtual mechanism.
// Original Incoprea. MIT. Planning only.
float PITCH=0.02;
integer STARTS=2;
float TURNS=12.0;
float RPM=30.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(PITCH<=0.0||STARTS<1||RPM<=0.0)
{
llOwnerSay("Invalid screw inputs.");
return;
}
float lead=PITCH*STARTS;
llOwnerSay("Lead="+(string)lead+" travel="+(string)(lead*TURNS)+" seconds="+(string)(60.0*llFabs(TURNS)/RPM));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCount distinct face texture references
Count exposed legacy texture identifiers on the current prim.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the exact prim and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Counts references, not texture memory, resolution, download size, or PBR maps. Repeated identifiers are counted once; hidden UUIDs are counted separately as unavailable.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
list textures=[];
integer hidden;
integer face;
for(face=0;face<llGetNumberOfSides();++face)
{
key texture=llList2Key(llGetPrimitiveParams([PRIM_TEXTURE,face]),0);
if(texture==NULL_KEY)++hidden;
else if(llListFindList(textures,[texture])==-1)textures += [texture];
}
llOwnerSay("Unique exposed base textures: "+(string)llGetListLength(textures)+"; unavailable face keys: "+(string)hidden);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · AdvancedCount model crossings of a reference plane
Count signed crossings of a plane through the start point using a dead band to suppress jitter.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Set a nonzero region-space NORMAL and positive DEADBAND; move only this model. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
Crossings between samples can be missed. Start-point plane is fixed for the session; stops at a region change.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
vector NORMAL=<1.0,0.0,0.0>;
float DEADBAND=0.05;
vector origin;
vector normal;
vector region;
integer side;
integer forward;
integer reverse;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
llOwnerSay("Negative-to-positive crossings="+(string)forward+" reverse="+(string)reverse);
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
if(llVecMag(NORMAL)<0.001||DEADBAND<=0.0)return;
origin=llGetPos();
normal=llVecNorm(NORMAL);
region=llGetRegionCorner();
side=0;
forward=0;
reverse=0;
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
if(llGetRegionCorner()!=region)
{
finish();
return;
}
float d=(llGetPos()-origin)*normal;
integer next=side;
if(d>DEADBAND)next=1;
else if(d< -DEADBAND)next=-1;
if(side==-1&&next==1)++forward;
if(side==1&&next==-1)++reverse;
side=next;
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5 · API reference 6
Building helpers · IntermediateCount steps between hex cells
Calculate the shortest number of neighboring-cell steps on an axial hex grid.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set integer axial endpoints Q1/R1 and Q2/R2. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
This ignores blocked cells and terrain costs; it is a lower bound for obstacle-aware routes.
// Original Incoprea. MIT. Planning only.
integer Q1=0;
integer R1=0;
integer Q2=4;
integer R2=-2;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer dq=Q2-Q1;
integer dr=R2-R1;
integer ds=-dq-dr;
integer distance=(llAbs(dq)+llAbs(dr)+llAbs(ds))/2;
llOwnerSay("Hex neighbor steps="+(string)distance);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateCreate a center bookmark between surface points
Print the midpoint between two actual clicked locations in region coordinates.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch two symmetric boundary points of the feature to center. Collect 2 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The arithmetic midpoint does not necessarily lie on a curved surface. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=2)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<2)
{
llOwnerSay("Recorded point "+(string)collected+" of 2.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector midpoint=(a+b)*0.5;
llOwnerSay("Midpoint="+(string)midpoint+" span="+(string)llVecDist(a,b));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateDetect texture mapping changes
Record one face’s texture identifier, repeats, offset, and angle; report changed fields later.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set FACE. Touch as owner before and after editing the face.
Stop / restore: Remove or disable. This inspector changes no build properties.
Base/legacy texture mapping only. No values are restored. Texture identifiers may be hidden by permissions; the script checks actual returned values.
// Original Incoprea example. MIT.
integer FACE=0;
list baseline;
integer ready;
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(FACE<0 || FACE>=llGetNumberOfSides())
{
llOwnerSay("Invalid face.");
return;
}
list current=llGetPrimitiveParams([PRIM_TEXTURE,FACE]);
if(!ready)
{
baseline=current;
ready=TRUE;
llOwnerSay("Texture mapping baseline recorded.");
return;
}
list labels=["texture","repeats","offset","angle"];
integer i;
for(i=0;i<4;++i) if(llList2String(current,i)!=llList2String(baseline,i)) llOwnerSay(llList2String(labels,i)+" changed: "+llList2String(baseline,i)+" -> "+llList2String(current,i));
llOwnerSay("Comparison complete.");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · AdvancedDetect when a moved model settles
Wait for three consecutive sampled positions within a small movement tolerance, or stop at thirty samples.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Start while moving a test model; set TOLERANCE for your build scale. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
No forces are applied. A quiet sample streak is not proof of physics sleep or future stability.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
float TOLERANCE=0.005;
vector previous;
integer quiet;
integer settled;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
llOwnerSay("Settled="+(string)settled+" quiet samples="+(string)quiet+" elapsed seconds="+(string)(llGetTime()-began));
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
if(TOLERANCE<=0.0||TOLERANCE>0.5)return;
previous=llGetPos();
quiet=0;
settled=FALSE;
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
vector current=llGetPos();
if(llVecDist(previous,current)<=TOLERANCE)++quiet;
else quiet=0;
previous=current;
if(quiet>=3)
{
settled=TRUE;
finish();
return;
}
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateDistribute low-clumping rectangle samples
Generate twelve deterministic low-discrepancy positions using base2/base3 Halton coordinates.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set positive WIDTH and HEIGHT. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Deterministic quasi-random positions are not guaranteed to have minimum clearance and are not secure random values.
// Original Incoprea. MIT. Planning only.
float WIDTH=8.0;
float HEIGHT=5.0;
float radical(integer index,integer base)
{
float value;
float factor=1.0/(float)base;
while(index>0)
{
value+=(index%base)*factor;
index/=base;
factor/=(float)base;
}
return value;
}
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(WIDTH<=0.0||HEIGHT<=0.0)
{
llOwnerSay("Positive dimensions required.");
return;
}
integer i;
for(i=1;i<=12;++i)llOwnerSay((string)<WIDTH*radical(i,2),HEIGHT*radical(i,3),0.0>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateDistribute terrace depths by a taper
Calculate a series of linearly changing step depths whose sum equals a specified run.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set count2..12, total run and positive first-to-last ratio. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
This is a terrace layout calculation rather than a staircase usability recommendation.
// Original Incoprea. MIT. Calculation only.
integer COUNT=6;
float RUN=9.0;
float FIRST_TO_LAST=2.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(COUNT<2||COUNT>12||RUN<=0.0||FIRST_TO_LAST<=0.0)
{
llOwnerSay("Invalid series.");
return;
}
float last=2.0*RUN/((float)COUNT*(FIRST_TO_LAST+1.0));
float first=last*FIRST_TO_LAST;
float start;
integer i;
for(i=0;i<COUNT;++i)
{
float depth=first+(last-first)*(float)i/(float)(COUNT-1);
llOwnerSay("Step "+(string)i+" start="+(string)start+" depth="+(string)depth);
start+=depth;
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateEstimate a helical handrail length
Calculate exact ideal helix length from radius, total height and turns.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set radius positive and number of turns nonnegative. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Does not include rail fittings, thickness, end extensions or segmentation error.
// Original Incoprea. MIT. Calculation only.
float RADIUS=2.0;
float HEIGHT=5.0;
float TURNS=1.5;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RADIUS<=0.0||TURNS<0.0)
{
llOwnerSay("Invalid radius/turns.");
return;
}
float run=TWO_PI*RADIUS*TURNS;
llOwnerSay("Helix length="+(string)llSqrt(run*run+HEIGHT*HEIGHT)+" slope angle="+(string)(llAtan2(HEIGHT,run)*RAD_TO_DEG));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateEstimate a small-angle pendulum period
Calculate the ideal small-angle period for a pendulum length and gravity magnitude.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive LENGTH and GRAVITY. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Educational idealization: large angles, damping and simulator physics change the real period.
// Original Incoprea. MIT. Planning only.
float LENGTH=2.0;
float GRAVITY=9.81;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(LENGTH<=0.0||GRAVITY<=0.0)
{
llOwnerSay("Positive length/gravity required.");
return;
}
llOwnerSay("Small-angle period seconds="+(string)(TWO_PI*llSqrt(LENGTH/GRAVITY)));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateEstimate objects needed for concentric rings
Allocate a segment count to each ring to keep arc spacing below a target.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set first radius, radial step, number of rings1..8 and maximum spacing. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Ring counts are independent; angular alignment between rings is not guaranteed. This estimates object count before construction.
// Original Incoprea. MIT. Planning only.
float FIRST_RADIUS=1.0;
float RADIAL_STEP=1.0;
integer RINGS=4;
float MAX_SPACING=1.2;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(FIRST_RADIUS<=0.0||RADIAL_STEP<=0.0||RINGS<1||RINGS>8||MAX_SPACING<=0.0)
{
llOwnerSay("Invalid ring inputs.");
return;
}
integer total;
integer i;
for(i=0;i<RINGS;++i)
{
float radius=FIRST_RADIUS+i*RADIAL_STEP;
integer count=llCeil(TWO_PI*radius/MAX_SPACING);
if(count<3)count=3;
total+=count;
llOwnerSay("Radius="+(string)radius+" count="+(string)count+" angle="+(string)(360.0/count));
}
llOwnerSay("Total objects planned="+(string)total);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateEstimate stopping distance with reaction delay
Combine reaction travel and constant-deceleration braking distance.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set nonnegative SPEED and REACTION_TIME and positive DECELERATION. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Ideal kinematics for a virtual controller. It does not predict simulator physics or guarantee a collision-free stop.
// Original Incoprea. MIT. Planning only.
float SPEED=5.0;
float REACTION_TIME=0.2;
float DECELERATION=2.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SPEED<0.0||REACTION_TIME<0.0||DECELERATION<=0.0)
{
llOwnerSay("Invalid inputs.");
return;
}
float reaction=SPEED*REACTION_TIME;
float braking=SPEED*SPEED/(2.0*DECELERATION);
llOwnerSay("Reaction travel="+(string)reaction+" braking="+(string)braking+" total="+(string)(reaction+braking));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateEvaluate a dwell-rise-dwell-return cam
Calculate a smooth cam follower displacement from one normalized revolution.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set phase0..1 and positive lift. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Each quarter of the revolution is assigned one stage. Uses cosine rise/return with zero endpoint velocity.
// Original Incoprea. MIT. Planning only.
float PHASE=0.35;
float LIFT=1.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(PHASE<0.0||PHASE>1.0||LIFT<0.0)
{
llOwnerSay("Invalid phase/lift.");
return;
}
float value;
string stage;
if(PHASE<0.25)
{
stage="low dwell";
value=0.0;
}
else if(PHASE<0.5)
{
stage="rise";
float t=(PHASE-0.25)*4.0;
value=0.5*(1.0-llCos(PI*t));
}
else if(PHASE<0.75)
{
stage="high dwell";
value=1.0;
}
else
{
stage="return";
float t=(PHASE-0.75)*4.0;
value=0.5*(1.0+llCos(PI*t));
}
llOwnerSay(stage+" lift="+(string)(LIFT*value));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateExport child offsets and rotations
Print each child’s root-local offset and quaternion for build notes.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded.
Stop / restore: Remove or disable. This inspector changes no build properties.
Root excluded because its local-position semantics differ. Output is not a full object backup; mesh, materials, inventory, and root transform are absent.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
integer i;
for(i=2;i<=total;++i)
{
list p=llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL]);
llOwnerSay((string)i+" "+llGetLinkName(i)+" position="+llList2String(p,0)+" rotation="+llList2String(p,1));
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateExport component world positions
Print each linked prim’s region position and world rotation for build notes.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
A transform manifest, not a complete backup. Does not capture meshes, textures, inventory, physics, or permissions.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
integer i;
for(i=1;i<=total;++i)
{
list data=llGetLinkPrimitiveParams(i,[PRIM_POSITION,PRIM_ROTATION]);
llOwnerSay("Link "+(string)i+" position="+llList2String(data,0)+" rotation="+llList2String(data,1));
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFace child toward root center
Turn child +X axis toward the root origin without moving it.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use offset nonphysical child; owner-touch previews/restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Roll is chosen by llRotBetween, not a camera-style up-vector constraint.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
rotation home;
default
{
state_entry()
{
home=llGetLocalRot();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS)||llVecMag(llGetLocalPos())<0.01)return;
preview=!preview;
if(preview)
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,llRotBetween(<1.0,0.0,0.0>,-llVecNorm(llGetLocalPos()))]);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,home]);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · BeginnerFace tint and transparency audit
Read each face’s legacy tint and alpha without changing them.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the exact prim to inspect and touch as owner.
Stop / restore: Remove or disable the script. It does not change the build.
Reports legacy face color/alpha settings, not texture pixel transparency or all PBR material settings. Copy the report to your notes before experimenting with a recoloring script.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
integer face;
integer total = llGetNumberOfSides();
for (face = 0; face < total; ++face)
llOwnerSay("Face " + (string)face + " tint " + (string)llGetColor(face)
+ " alpha " + (string)llGetAlpha(face));
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFill a panel and calculate image crop
Calculate centered normalized UV span for an aspect-preserving image that fully covers a panel.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set image width/height and panel width/height. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
The crop assumes centered image alignment. Applying UV values depends on the actual face mapping and texture conventions.
// Original Incoprea. MIT. Planning only.
float IW=1920.0;
float IH=1080.0;
float PW=3.0;
float PH=4.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(IW<=0.0||IH<=0.0||PW<=0.0||PH<=0.0)
{
llOwnerSay("Positive dimensions required.");
return;
}
float scale=PW/IW;
if(PH/IH>scale)scale=PH/IH;
float u=PW/(IW*scale);
float v=PH/(IH*scale);
llOwnerSay("Visible UV span="+(string)<u,v,0.0>+"; minimum UV="+(string)<(1.0-u)*0.5,(1.0-v)*0.5,0.0>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFind a build’s dominant bounds axis
Report bounding-box proportions and whether the longest axis is X, Y, or Z.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed object without seated avatars; touch as owner.
Stop / restore: Remove or disable. This inspector changes no build properties.
Bounds are root-local and based on physical representation. Seated avatars can enlarge them; mesh visible geometry can differ.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed object.");
return;
}
list bounds=llGetBoundingBox(llGetKey());
if(llGetListLength(bounds)!=2)
{
llOwnerSay("Bounds unavailable.");
return;
}
vector extent=llList2Vector(bounds,1)-llList2Vector(bounds,0);
float longest=extent.x;
string axis="X";
if(extent.y>longest)
{
longest=extent.y;
axis="Y";
}
if(extent.z>longest)
{
longest=extent.z;
axis="Z";
}
if(longest<=0.0)
{
llOwnerSay("Degenerate bounds.");
return;
}
llOwnerSay("Dominant local axis: "+axis+"; relative proportions: "+(string)(extent/longest));
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateFind a component by Description tag
Find linked prims whose Description contains a configured literal marker.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded. Set MARKER, for example role:lamp.
Stop / restore: Remove or disable. This inspector changes no build properties.
Literal substring search is case-sensitive and may match a longer value. It does not interpret Description as structured data or change it.
// Original Incoprea example. MIT.
string MARKER="role:lamp";
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
if(MARKER=="")
{
llOwnerSay("Set a nonempty marker.");
return;
}
integer i;
integer matches;
for(i=1;i<=total;++i)
{
string description=llList2String(llGetLinkPrimitiveParams(i,[PRIM_DESC]),0);
if(llSubStringIndex(description,MARKER)!=-1)
{
++matches;
llOwnerSay("Match at "+(string)i+": "+llGetLinkName(i));
}
}
llOwnerSay("Matches: "+(string)matches);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFind an intercept for a moving target
Solve for a constant-speed intercept with a target moving at a known velocity.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set relative TARGET_POSITION, TARGET_VELOCITY and positive CHASER_SPEED. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Uses supplied vectors only; no avatar tracking. Assumes straight constant velocity and no obstacles.
// Original Incoprea. MIT. Planning only.
vector TARGET_POSITION=<12.0,4.0,0.0>;
vector TARGET_VELOCITY=<0.0,1.0,0.0>;
float CHASER_SPEED=4.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(CHASER_SPEED<=0.0)
{
llOwnerSay("Positive speed required.");
return;
}
float a=TARGET_VELOCITY*TARGET_VELOCITY-CHASER_SPEED*CHASER_SPEED;
float b=2.0*(TARGET_POSITION*TARGET_VELOCITY);
float c=TARGET_POSITION*TARGET_POSITION;
float t=-1.0;
if(llFabs(a)<0.000001)
{
if(llFabs(b)>0.000001)t=-c/b;
}
else
{
float d=b*b-4.0*a*c;
if(d>=0.0)
{
float root=llSqrt(d);
float t1=(-b-root)/(2.0*a);
float t2=(-b+root)/(2.0*a);
if(t1>0.0)t=t1;
if(t2>0.0&&(t<0.0||t2<t))t=t2;
}
}
if(t<=0.0)
{
llOwnerSay("No future intercept.");
return;
}
llOwnerSay("Time="+(string)t+" relative intercept="+(string)(TARGET_POSITION+t*TARGET_VELOCITY));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateFind coincident component centers
Report pairs of child prims whose local centers are within a small tolerance.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded. Edit TOLERANCE in meters.
Stop / restore: Remove or disable. This inspector changes no build properties.
This compares centers, not mesh overlap or collision shapes. Pairs at identical centers may be intentional. Bounded to 64 prims.
// Original Incoprea example. MIT.
float TOLERANCE=0.001;
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
if(TOLERANCE<=0.0 || TOLERANCE>1.0)
{
llOwnerSay("Use a tolerance above zero and at most one meter.");
return;
}
list positions=[];
integer i;
integer j;
integer matches;
for(i=2;i<=total;++i) positions+=llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]);
for(i=0;i<llGetListLength(positions);++i) for(j=i+1;j<llGetListLength(positions);++j)
{
if(llVecDist(llList2Vector(positions,i),llList2Vector(positions,j))<TOLERANCE)
{
++matches;
llOwnerSay("Near-coincident child centers: "+(string)(i+2)+" / "+(string)(j+2));
}
}
llOwnerSay("Pairs found: "+(string)matches);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFind duplicate linked-prim names
Find names that identify more than one prim in a linkset.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded.
Stop / restore: Remove or disable. This inspector changes no build properties.
Exact case-sensitive names are compared. Duplicate names can be intentional, but name-driven controls should handle them explicitly.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
list names=[];
list numbers=[];
integer i;
for(i=1;i<=total;++i)
{
string name=llGetLinkName(i);
integer previous=llListFindList(names,[name]);
if(previous!=-1) llOwnerSay("Duplicate name ["+name+"] at links "+llList2String(numbers,previous)+" and "+(string)i);
else
{
names += [name];
numbers += [i];
}
}
llOwnerSay("Link-name audit finished.");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFind mirrored child-center pairs
Report pairs whose centers mirror each other across the root-local X=0 plane.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed linkset of 2-32 prims and touch as owner. Edit TOLERANCE.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Only matches center positions; orientation, scale, mesh shape, and appearance are not compared. Points on the mirror plane can match each other.
// Original Incoprea example. MIT.
float TOLERANCE=0.01;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
if(TOLERANCE<0 || TOLERANCE>1)
{
llOwnerSay("Use a tolerance from 0 to 1 meter.");
return;
}
list positions=[];
integer i;
integer j;
for(i=2;i<=total;++i)positions+=llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]);
for(i=0;i<llGetListLength(positions);++i)
{
vector p=llList2Vector(positions,i);
vector mirror=<-p.x,p.y,p.z>;
for(j=i+1;j<llGetListLength(positions);++j)if(llVecDist(mirror,llList2Vector(positions,j))<=TOLERANCE)llOwnerSay("Mirror-center pair: "+(string)(i+2)+" / "+(string)(j+2));
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFind mirrored texture repeats
Report faces whose legacy texture repeats have a negative X or Y value.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the exact prim and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Negative repeats can intentionally mirror images. This is a diagnostic report, not a correction; mesh UV orientation can also mirror an image.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer face;
integer findings;
for(face=0;face<llGetNumberOfSides();++face)
{
vector repeats=llList2Vector(llGetPrimitiveParams([PRIM_TEXTURE,face]),1);
if(repeats.x<0 || repeats.y<0)
{
++findings;
llOwnerSay("Mirrored repeat on face "+(string)face+": "+(string)repeats);
}
}
llOwnerSay("Faces with negative repeat: "+(string)findings);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFind nearly coincident planned vertices
Report all point pairs separated by less than a chosen tolerance.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set POINTS with at most12 positions and positive TOLERANCE. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
This is a small quadratic comparison; it reports proximity without merging points.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,0.0,0.0>,<1.0,0.0,0.0>,<1.001,0.0,0.0>,<2.0,1.0,0.0>];
float TOLERANCE=0.01;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(POINTS);
if(n>12||TOLERANCE<=0.0)
{
llOwnerSay("Use at most12 points and positive tolerance.");
return;
}
integer found;
integer i;
integer j;
for(i=0;i<n;++i)for(j=i+1;j<n;++j)if(llVecDist(llList2Vector(POINTS,i),llList2Vector(POINTS,j))<TOLERANCE)
{
++found;
llOwnerSay("Close pair="+(string)i+","+(string)j);
}
llOwnerSay("Close pairs="+(string)found);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFind smallest and largest component boxes
Compare products of prim X/Y/Z scale and report the extreme components.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded.
Stop / restore: Remove or disable. This inspector changes no build properties.
The product is a bounding-box size proxy, not actual mesh volume, physics mass, or land impact.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
float smallest=1.0e30;
float largest=-1.0;
integer smallLink;
integer largeLink;
integer i;
for(i=1;i<=total;++i)
{
vector size=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_SIZE]),0);
float proxy=size.x*size.y*size.z;
if(proxy<smallest)
{
smallest=proxy;
smallLink=i;
}
if(proxy>largest)
{
largest=proxy;
largeLink=i;
}
}
llOwnerSay("Smallest scale box: "+(string)smallLink+" "+llGetLinkName(smallLink)+" = "+(string)smallest+" m3");
llOwnerSay("Largest scale box: "+(string)largeLink+" "+llGetLinkName(largeLink)+" = "+(string)largest+" m3");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFind the child nearest the root center
Identify the smallest root-local child offset magnitude.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Compares prim centers, not surfaces or collision distance. This can help identify a hub component before selecting a pivot manually.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
float closest=1e30;
integer chosen;
integer i;
for(i=2;i<=total;++i)
{
vector p=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
float distance=llVecMag(p);
if(distance<closest)
{
closest=distance;
chosen=i;
}
}
llOwnerSay("Nearest child center: "+(string)chosen+" "+llGetLinkName(chosen)+" at "+(string)closest+" m");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFind the nearest planned anchor
Select the closest point from a small supplied anchor list and report its index and distance.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set ANCHORS and QUERY. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
This uses provided coordinates only, not nearby avatars or scene sensing. Ties choose the first anchor.
// Original Incoprea. MIT. Planning only.
list ANCHORS=[<0.0,0.0,0.0>,<5.0,0.0,0.0>,<2.0,4.0,0.0>];
vector QUERY=<3.0,2.0,0.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(ANCHORS);
if(n==0)
{
llOwnerSay("No anchors.");
return;
}
integer best=0;
float distance=llVecDist(QUERY,llList2Vector(ANCHORS,0));
integer i;
for(i=1;i<n;++i)
{
float d=llVecDist(QUERY,llList2Vector(ANCHORS,i));
if(d<distance)
{
distance=d;
best=i;
}
}
llOwnerSay("Anchor="+(string)best+" position="+(string)llList2Vector(ANCHORS,best)+" distance="+(string)distance);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFind the six neighboring hex cells
Print six adjacent pointy-top axial hex centers around a selected cell.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set axial Q/R and positive hex RADIUS. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Axial coordinates are integers; radius is center-to-corner distance.
// Original Incoprea. MIT. Planning only.
integer Q=2;
integer R=-1;
float RADIUS=1.0;
list DIRECTIONS=[<1.0,0.0,0.0>,<1.0,-1.0,0.0>,<0.0,-1.0,0.0>,<-1.0,0.0,0.0>,<-1.0,1.0,0.0>,<0.0,1.0,0.0>];
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RADIUS<=0.0)
{
llOwnerSay("Positive radius required.");
return;
}
integer i;
for(i=0;i<6;++i)
{
vector d=llList2Vector(DIRECTIONS,i);
float q=Q+d.x;
float r=R+d.y;
llOwnerSay("Neighbor axial="+(string)<q,r,0.0>+" center="+(string)<RADIUS*llSqrt(3.0)*(q+r*0.5),1.5*RADIUS*r,0.0>);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFind undescribed linked components
Report links whose Description field is blank or whitespace-only.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded.
Stop / restore: Remove or disable. This inspector changes no build properties.
Description may already be reserved for another script. This only identifies blank fields and never writes labels.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
integer i;
integer empty;
for(i=1;i<=total;++i)
{
string description=llList2String(llGetLinkPrimitiveParams(i,[PRIM_DESC]),0);
if(llStringTrim(description,STRING_TRIM)=="")
{
++empty;
llOwnerSay("Blank description: "+(string)i+" "+llGetLinkName(i));
}
}
llOwnerSay((string)empty+" blank descriptions.");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · AdvancedFit an X-axis beam between live anchors
Position, orient and resize a child beam so its local X length spans two named child centers.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Use a boxlike child beam whose length axis is +X; name other children beam_a and beam_b. Owner-touch the child to preview; touch again to restore.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Uses bounding dimensions. Length must be0.01–64 meters; simulator link/build limits may reject or clamp. Clear surrounding geometry first.
// Original Incoprea. MIT. Test on a spare copy first.
integer selected;
key identity;
list original;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
if(selected)
{
if(llGetLinkKey(selected)==identity)llSetLinkPrimitiveParamsFast(selected,[PRIM_POS_LOCAL,llList2Vector(original,0),PRIM_ROT_LOCAL,llList2Rot(original,1),PRIM_SIZE,llList2Vector(original,2)]);
else llOwnerSay("Topology changed; restore manually from backup.");
selected=0;
return;
}
integer link=llDetectedLinkNumber(0);
if(link<2||link>llGetObjectPrimCount(llGetKey()))
{
llOwnerSay("Touch a child prim.");
return;
}
list data=llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL,PRIM_SIZE]);
vector p=llList2Vector(data,0);
rotation r=llList2Rot(data,1);
vector size=llList2Vector(data,2);
integer i;
integer a;
integer b;
integer ca;
integer cb;
integer total=llGetObjectPrimCount(llGetKey());
if(total>32)return;
for(i=2;i<=total;++i)
{
if(llGetLinkName(i)=="beam_a")
{
a=i;
++ca;
}
if(llGetLinkName(i)=="beam_b")
{
b=i;
++cb;
}
}
if(ca!=1||cb!=1||a==link||b==link)return;
vector ap=llList2Vector(llGetLinkPrimitiveParams(a,[PRIM_POS_LOCAL]),0);
vector bp=llList2Vector(llGetLinkPrimitiveParams(b,[PRIM_POS_LOCAL]),0);
float length=llVecDist(ap,bp);
if(length<0.01||length>64.0)return;
p=(ap+bp)*0.5;
r=llRotBetween(<1.0,0.0,0.0>,llVecNorm(bp-ap));
size.x=length;
selected=link;
identity=llGetLinkKey(link);
original=data;
llSetLinkPrimitiveParamsFast(link,[PRIM_POS_LOCAL,p,PRIM_ROT_LOCAL,r,PRIM_SIZE,size]);
llOwnerSay("Preview applied; touch again to restore.");
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFit artwork inside a display rectangle
Calculate the largest aspect-preserving image rectangle that fits entirely inside a panel.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set image pixel dimensions and panel metre dimensions. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Returns displayed width/height and symmetric margins; does not upload or apply an image.
// Original Incoprea. MIT. Planning only.
float IW=1920.0;
float IH=1080.0;
float PW=4.0;
float PH=3.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(IW<=0.0||IH<=0.0||PW<=0.0||PH<=0.0)
{
llOwnerSay("Positive dimensions required.");
return;
}
float scale=PW/IW;
if(PH/IH<scale)scale=PH/IH;
float w=IW*scale;
float h=IH*scale;
llOwnerSay("Image size="+(string)<w,h,0.0>+"; margins="+(string)<(PW-w)*0.5,(PH-h)*0.5,0.0>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFit fence pickets between posts
Choose the greatest picket count fitting a minimum clear gap and equalize all gaps.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set clear span, picket width and minimum gap. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Includes gaps adjacent to both end posts. If none fit, it reports that instead of returning negative dimensions.
// Original Incoprea. MIT. Calculation only.
float SPAN=5.0;
float WIDTH=0.12;
float MIN_GAP=0.08;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SPAN<=0.0||WIDTH<=0.0||MIN_GAP<0.0)
{
llOwnerSay("Invalid dimensions.");
return;
}
integer count=llFloor((SPAN-MIN_GAP)/(WIDTH+MIN_GAP));
if(count<1)
{
llOwnerSay("No picket fits.");
return;
}
float gap=(SPAN-count*WIDTH)/(count+1);
llOwnerSay("Pickets="+(string)count+" clear gaps="+(string)gap+" first centre="+(string)(gap+WIDTH*0.5));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFive-layer cutaway control
Peel away named model layers one touch at a time, preserving each face alpha.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Name children layer1 through layer5. Put script in root. First touch hides layer5, then4,3,2,1; sixth restores all.
Stop / restore: Complete the six-touch cycle before removal; relinking invalidates stored link indices.
Use a spare modifiable build. Snapshot state is held only in script memory; restore before reset/removal. Do not relink during a preview. Only visibility changes; transparent parts still collide. PBR appearance and special alpha modes may differ.
// Original Incoprea. MIT. Not compiled or tested in-world.
list saved;
integer step;
integer valid=TRUE;
default
{
state_entry()
{
integer link;
for(link=2;link<=llGetObjectPrimCount(llGetKey());++link)
{
string name=llGetLinkName(link);
integer layer=llListFindList(["layer1","layer2","layer3","layer4","layer5"],[name])+1;
if(layer)
{
integer f;
for(f=0;f<llGetLinkNumberOfSides(link);++f)saved+=[link,f,layer]+llGetLinkPrimitiveParams(link,[PRIM_COLOR,f]);
}
}
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner()||llGetLinkNumber()>1||!valid)return;
step=(step+1)%6;
integer i;
for(i=0;i<llGetListLength(saved);i+=5)
{
float alpha=llList2Float(saved,i+4);
if(step&&llList2Integer(saved,i+2)>5-step)alpha=0.0;
llSetLinkPrimitiveParamsFast(llList2Integer(saved,i),[PRIM_COLOR,llList2Integer(saved,i+1),llList2Vector(saved,i+3),alpha]);
}
}
changed(integer change)
{
if(change&CHANGED_LINK)valid=FALSE;
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateFlag a thin triangle by altitude ratio
Calculate the shortest altitude relative to the longest edge for a triangle.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set A/B/C. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
A small ratio identifies a skinny triangle; this is a diagnostic metric, not a mesh-quality guarantee.
// Original Incoprea. MIT. Planning only.
vector A=ZERO_VECTOR;
vector B=<5.0,0.0,0.0>;
vector C=<2.0,0.1,0.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
float ab=llVecDist(A,B);
float bc=llVecDist(B,C);
float ca=llVecDist(C,A);
float longest=ab;
if(bc>longest)longest=bc;
if(ca>longest)longest=ca;
if(longest<0.000001)
{
llOwnerSay("Coincident triangle.");
return;
}
float twiceArea=llVecMag((B-A)%(C-A));
float altitude=twiceArea/longest;
llOwnerSay("Shortest altitude="+(string)altitude+" slenderness ratio="+(string)(altitude/longest));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateFlag steep segments in a planned walkway
Calculate rise divided by horizontal run for each path segment and compare with a chosen grade limit.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set POINTS and nonnegative MAX_GRADE_PERCENT. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
User-selected threshold is a virtual-design preference, not a legal accessibility standard.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,0.0,0.0>,<4.0,0.0,0.3>,<6.0,2.0,1.2>];
float MAX_GRADE_PERCENT=10.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(MAX_GRADE_PERCENT<0.0)
{
llOwnerSay("Nonnegative limit required.");
return;
}
integer i;
for(i=1;i<llGetListLength(POINTS);++i)
{
vector d=llList2Vector(POINTS,i)-llList2Vector(POINTS,i-1);
float run=llSqrt(d.x*d.x+d.y*d.y);
if(run<0.000001)llOwnerSay("Segment "+(string)i+" vertical or zero-length.");
else
{
float grade=100.0*d.z/run;
llOwnerSay("Segment "+(string)i+" grade="+(string)grade+" exceeds="+(string)(llFabs(grade)>MAX_GRADE_PERCENT));
}
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateGenerate a face-finish restoration snippet
Print LSL statements restoring current face color, alpha, glow, and fullbright values.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the prim before an experiment and touch as owner. Copy the reported statements into your own restore script.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Output is source text only and is not run automatically. Does not capture textures, PBR materials, normal/specular maps, or future changes.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer face;
for(face=0;face<llGetNumberOfSides();++face)
{
list p=llGetPrimitiveParams([PRIM_COLOR,face,PRIM_GLOW,face,PRIM_FULLBRIGHT,face]);
llOwnerSay("llSetPrimitiveParams([PRIM_COLOR, "+(string)face+", "+llList2String(p,0)+", "+llList2String(p,1)+", PRIM_GLOW, "+(string)face+", "+llList2String(p,2)+", PRIM_FULLBRIGHT, "+(string)face+", "+llList2String(p,3)+"]);");
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · BeginnerHow many material faces?
Report how many faces LSL exposes on this prim.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the exact prim or mesh and touch as owner.
Stop / restore: Remove or disable the script. It does not change the build.
Mesh material faces are not individual polygons. Face indices start at zero.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
integer faces = llGetNumberOfSides();
llOwnerSay((string)faces + " faces; valid indices 0 through " + (string)(faces - 1) + ".");
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateIdentify sharp turns in a planned route
Report signed horizontal heading changes at each interior route vertex.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set POINTS with3..12 vertices. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Repeated points are skipped with a warning. Angles do not imply whether a physical object can traverse the turn.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,0.0,0.0>,<4.0,0.0,0.0>,<5.0,3.0,0.0>,<2.0,5.0,0.0>];
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(POINTS);
if(n<3||n>12)
{
llOwnerSay("Use3..12 points.");
return;
}
integer i;
for(i=1;i<n-1;++i)
{
vector incoming=llList2Vector(POINTS,i)-llList2Vector(POINTS,i-1);
vector outgoing=llList2Vector(POINTS,i+1)-llList2Vector(POINTS,i);
incoming.z=0.0;
outgoing.z=0.0;
if(llVecMag(incoming)<0.000001||llVecMag(outgoing)<0.000001)llOwnerSay("Repeated XY point near index "+(string)i);
else llOwnerSay("Turn "+(string)i+" degrees="+(string)(llAtan2(incoming.x*outgoing.y-incoming.y*outgoing.x,incoming*outgoing)*RAD_TO_DEG));
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateInset a regular polygon border
Calculate inner apothem, inner circumradius and border area for a regular polygon frame.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set sides>=3, outer circumradius and inward border width. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
The inset uses parallel edges and must remain inside the original apothem.
// Original Incoprea. MIT. Calculation only.
integer SIDES=6;
float RADIUS=5.0;
float BORDER=0.4;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SIDES<3||RADIUS<=0.0||BORDER<0.0)
{
llOwnerSay("Invalid polygon.");
return;
}
float angle=PI/SIDES;
float apothem=RADIUS*llCos(angle);
if(BORDER>=apothem)
{
llOwnerSay("Border consumes the polygon.");
return;
}
float inner=(apothem-BORDER)/llCos(angle);
float factor=0.5*SIDES*llSin(TWO_PI/SIDES);
llOwnerSay("Inner circumradius="+(string)inner+" border area="+(string)(factor*(RADIUS*RADIUS-inner*inner)));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateInset atlas UVs to reduce edge bleed
Calculate normalized inset bounds for an atlas cell with a pixel gutter.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set image dimensions, cell pixel bounds and inset pixels. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Padding reduces neighboring-cell sampling but cannot eliminate every mipmap or filtering artifact.
// Original Incoprea. MIT. Planning only.
float IW=1024.0;
float IH=1024.0;
float X=256.0;
float Y=512.0;
float W=256.0;
float H=256.0;
float PAD=2.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(IW<=0.0||IH<=0.0||W<=2.0*PAD||H<=2.0*PAD||PAD<0.0||X<0.0||Y<0.0||X+W>IW||Y+H>IH)
{
llOwnerSay("Invalid cell or padding.");
return;
}
llOwnerSay("U="+(string)((X+PAD)/IW)+".."+(string)((X+W-PAD)/IW)+"; V="+(string)(1.0-(Y+H-PAD)/IH)+".."+(string)(1.0-(Y+PAD)/IH));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateInspect a bounded PID control step
Calculate proportional, integral and derivative terms with output and integral clamping.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Touch repeatedly to feed the next predefined measurement. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
A teaching controller with fixed sample time, not a ready physics controller. Real control needs measured dt, reset handling and tuning.
// Original Incoprea. MIT. Planning only.
list MEASUREMENTS=[0.0,0.4,0.7,0.9,1.1,1.0];
integer cursor;
float integral;
float previousError;
integer initialized;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
float measured=llList2Float(MEASUREMENTS,cursor);
cursor=(cursor+1)%llGetListLength(MEASUREMENTS);
float dt=0.1;
float error=1.0-measured;
integral+=error*dt;
if(integral>0.5)integral=0.5;
if(integral< -0.5)integral=-0.5;
float derivative=0.0;
if(initialized)derivative=(error-previousError)/dt;
previousError=error;
initialized=TRUE;
float output=2.0*error+0.8*integral+0.1*derivative;
if(output>1.0)output=1.0;
if(output< -1.0)output=-1.0;
llOwnerSay("Measurement="+(string)measured+" error="+(string)error+" output="+(string)output);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateInspect a prim’s world axes
Print where this prim’s local X, Y, and Z directions point in the region.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed prim and touch as owner.
Stop / restore: Remove or disable. This inspector changes no build properties.
Directions are unit vectors. They do not identify a mesh’s artistic front; the creator may model the nose or face along any local axis.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed prim.");
return;
}
rotation orientation=llGetRot();
llOwnerSay("Local +X in world: "+(string)llRot2Fwd(orientation));
llOwnerSay("Local +Y in world: "+(string)llRot2Left(orientation));
llOwnerSay("Local +Z in world: "+(string)llRot2Up(orientation));
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · BeginnerInspect a touched face
Read the base texture transform of the face you touch.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the inspected prim. Touch one of its faces as owner; in a linkset the touched prim must contain this script.
Stop / restore: Remove or disable the script. It does not change the build.
Reports legacy/base texture settings. It does not inspect PBR material parameters. Texture UUID visibility depends on permissions.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
integer ownLink = llGetLinkNumber();
integer touchedLink = llDetectedLinkNumber(0);
if (ownLink > 0 && touchedLink != ownLink)
{
llOwnerSay("Touch the prim containing this script.");
return;
}
integer face = llDetectedTouchFace(0);
if (face == TOUCH_INVALID_FACE)
{
llOwnerSay("The viewer did not provide a face.");
return;
}
list p = llGetPrimitiveParams([PRIM_TEXTURE, face]);
llOwnerSay("Face " + (string)face + ": " + llList2CSV(p));
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateInspect a triangular opening’s clear heights
Calculate each triangle altitude from live corners and identify the smallest.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch three corners around the opening. Collect 3 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Altitudes are geometric face dimensions, not a guarantee that an avatar or object will pass through. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=3)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<3)
{
llOwnerSay("Recorded point "+(string)collected+" of 3.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float ab=llVecDist(a,b);
float bc=llVecDist(b,c);
float ca=llVecDist(c,a);
float twiceArea=llVecMag((b-a)%(c-a));
if(ab<0.000001||bc<0.000001||ca<0.000001)
{
llOwnerSay("Repeated vertex.");
return;
}
llOwnerSay("Altitudes oppositeAB/BC/CA="+(string)<twiceArea/ab,twiceArea/bc,twiceArea/ca>);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · BeginnerInspect the physics shape setting
Report whether this prim uses Prim, Convex Hull, or None for its physics shape.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in the prim to inspect and touch as owner.
Stop / restore: Remove or disable the script. It does not change the build.
This does not display the actual collision mesh or change land impact. Physics-shape support can vary by simulator; a visual mesh is not necessarily its collision shape.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
list result = llGetPrimitiveParams([PRIM_PHYSICS_SHAPE_TYPE]);
if (llGetListLength(result) != 1)
{
llOwnerSay("Physics shape data unavailable.");
return;
}
integer shape = llList2Integer(result, 0);
string name = "Unknown (" + (string)shape + ")";
if (shape == PRIM_PHYSICS_SHAPE_PRIM) name = "Prim";
else if (shape == PRIM_PHYSICS_SHAPE_CONVEX) name = "Convex Hull";
else if (shape == PRIM_PHYSICS_SHAPE_NONE) name = "None";
llOwnerSay("Physics shape setting: " + name);
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateInspect the touched surface frame
Read surface normal and binormal and derive the third tangent direction.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Touch a visible surface as owner.
Stop / restore: Remove or disable. This inspector changes no build properties.
These are viewer-supplied touch vectors in region coordinates. Invalid or degenerate data is rejected; no object is rotated.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llDetectedTouchFace(0)==TOUCH_INVALID_FACE)
{
llOwnerSay("Surface data unavailable.");
return;
}
vector normal=llDetectedTouchNormal(0);
vector binormal=llDetectedTouchBinormal(0);
if(llVecMag(normal)<0.0001 || llVecMag(binormal)<0.0001)
{
llOwnerSay("Degenerate touch frame.");
return;
}
vector tangent=llVecNorm(binormal % normal);
llOwnerSay("Normal: "+(string)normal+" / binormal: "+(string)binormal+" / tangent: "+(string)tangent);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateInspect triangle areas in a polygon fan
Triangulate from the first vertex and report each fan triangle area.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set ordered convex planar POINTS. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
A simple fan is appropriate for convex polygons; concave or nonplanar inputs can overlap or misrepresent area.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,0.0,0.0>,<4.0,0.0,0.0>,<5.0,3.0,0.0>,<2.0,5.0,0.0>,<0.0,3.0,0.0>];
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(POINTS);
if(n<3)
{
llOwnerSay("Need three vertices.");
return;
}
vector origin=llList2Vector(POINTS,0);
float total;
integer i;
for(i=1;i<n-1;++i)
{
vector a=llList2Vector(POINTS,i)-origin;
vector b=llList2Vector(POINTS,i+1)-origin;
float area=0.5*llVecMag(a%b);
total+=area;
llOwnerSay("Triangle0,"+(string)i+","+(string)(i+1)+" area="+(string)area);
}
llOwnerSay("Fan total area="+(string)total);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · AdvancedLay out unequal parts with equal edge gaps
Arrange children along root-local X using each rotated bounding-box projected width, not equal center spacing.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Set GAP and START_X. Limit12 actual prims. Owner-touch applies/restores; all children are included in link order.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Preserves each part’s Y, Z and rotation. Bounding-box gaps are not exact gaps between irregular meshes. Use an isolated copied assembly.
// Original Incoprea. MIT. Test on a spare copy first.
float GAP=0.2;
float START_X=-2.0;
list saved;
integer active;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
integer i;
if(active)
{
for(i=0;i<llGetListLength(saved);i+=3)
{
integer link=llList2Integer(saved,i);
if(llGetLinkKey(link)==llList2Key(saved,i+1))llSetLinkPrimitiveParamsFast(link,[PRIM_POS_LOCAL,llList2Vector(saved,i+2)]);
}
active=FALSE;
saved=[];
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2||total>12||GAP<0.0||GAP>2.0)return;
list targets;
float cursor=START_X;
for(i=2;i<=total;++i)
{
list data=llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL,PRIM_SIZE,PRIM_ROT_LOCAL]);
vector p=llList2Vector(data,0);
vector size=llList2Vector(data,1);
rotation r=llList2Rot(data,2);
vector x=<1.0,0.0,0.0>*r;
vector y=<0.0,1.0,0.0>*r;
vector z=<0.0,0.0,1.0>*r;
float width=llFabs(x.x)*size.x+llFabs(y.x)*size.y+llFabs(z.x)*size.z;
p.x=cursor+width*0.5;
if(llFabs(p.x)>20.0)
{
llOwnerSay("Planned row exceeds20 meter local bound.");
return;
}
targets += [p];
cursor += width+GAP;
}
for(i=2;i<=total;++i)
{
saved += [i,llGetLinkKey(i),llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0)];
llSetLinkPrimitiveParamsFast(i,[PRIM_POS_LOCAL,llList2Vector(targets,i-2)]);
}
active=TRUE;
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateLinked direction-vector arrow
Aim one child arrow along a checked three-number vector message.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Name child vector_arrow with its front along +X. Root owner-touch arms; root script sends code8063 and x,y,z integers from -100 to100.
Stop / restore: Owner-touch disarms and restores the arrow rotation.
Use a spare modifiable build. Snapshot state is held only in script memory; restore before reset/removal. Do not relink during a preview. Direction is root-local; magnitude is ignored. Zero vector rejected; nonphysical build only.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer target;
rotation home;
integer active;
integer valid=TRUE;
default
{
state_entry()
{
integer i;
integer count;
for(i=2;i<=llGetObjectPrimCount(llGetKey());++i)if(llGetLinkName(i)=="vector_arrow")
{
target=i;
++count;
}
if(count!=1)
{
valid=FALSE;
return;
}
home=llList2Rot(llGetLinkPrimitiveParams(target,[PRIM_ROT_LOCAL]),0);
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner()||llGetLinkNumber()>1||llGetStatus(STATUS_PHYSICS)||!valid)return;
active=!active;
if(!active)llSetLinkPrimitiveParamsFast(target,[PRIM_ROT_LOCAL,home]);
}
link_message(integer sender,integer code,string s,key data)
{
if(!active||!valid||sender!=1||code!=8063||llGetStatus(STATUS_PHYSICS))return;
list values=llCSV2List(s);
if(llGetListLength(values)!=3)return;
integer i;
for(i=0;i<3;++i)
{
string value=llStringTrim(llList2String(values,i),STRING_TRIM);
integer v=(integer)value;
if((string)v!=value||llAbs(v)>100)return;
}
vector direction=<llList2Float(values,0),llList2Float(values,1),llList2Float(values,2)>;
if(llVecMag(direction)<0.01)return;
llSetLinkPrimitiveParamsFast(target,[PRIM_ROT_LOCAL,llRotBetween(<1.0,0.0,0.0>,llVecNorm(direction))]);
}
changed(integer change)
{
if(change&CHANGED_LINK)
{
active=FALSE;
valid=FALSE;
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · BeginnerLinkset bounding box
Report a rezzed linkset’s local bounding-box corners and extent.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed object; touch as owner. Deselect seated avatars when measuring a bare build.
Stop / restore: Remove or disable the script. It does not change the build.
Bounds use root-local axes and physical representation. Seated avatars can affect them; attachments have different behavior. Mesh visible geometry may differ.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
list bounds = llGetBoundingBox(llGetKey());
if (llGetListLength(bounds) != 2)
{
llOwnerSay("Bounds unavailable.");
return;
}
vector low = llList2Vector(bounds, 0);
vector high = llList2Vector(bounds, 1);
llOwnerSay("Local minimum: " + (string)low);
llOwnerSay("Local maximum: " + (string)high);
llOwnerSay("Extent: " + (string)(high - low));
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateList all eight corners of a rotated box
Enumerate local half-extents and transform each corner by a planned box pose.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set positive SIZE, CENTER and Euler ANGLES. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
An oriented ideal box, not a mesh-bound query. The corner order follows three binary sign bits.
// Original Incoprea. MIT. Planning only.
vector SIZE=<4.0,2.0,3.0>;
vector CENTER=<5.0,5.0,2.0>;
vector ANGLES=<0.0,0.0,30.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SIZE.x<=0.0||SIZE.y<=0.0||SIZE.z<=0.0)
{
llOwnerSay("Positive size required.");
return;
}
rotation r=llEuler2Rot(ANGLES*DEG_TO_RAD);
integer i;
for(i=0;i<8;++i)
{
float x=-0.5;
float y=-0.5;
float z=-0.5;
if(i&1)x=0.5;
if(i&2)y=0.5;
if(i&4)z=0.5;
llOwnerSay((string)i+": "+(string)(CENTER+<SIZE.x*x,SIZE.y*y,SIZE.z*z>*r));
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateList components by local X position
Sort child prims from left to right along root-local X.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed linkset of 2-32 prims. Touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Sorting affects only report order, not link numbers. Equal X positions may retain simulator/list-sort tie behavior; no topology changes occur.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
list rows=[];
integer i;
for(i=2;i<=total;++i)
{
vector p=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
rows += [p.x,i];
}
rows=llListSort(rows,2,TRUE);
for(i=0;i<llGetListLength(rows);i+=2)
{
integer link=llList2Integer(rows,i+1);
llOwnerSay("X="+llList2String(rows,i)+": "+(string)link+" "+llGetLinkName(link));
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateLocate a frame inside an atlas
Calculate a sprite frame’s row, column and normalized UV bounds.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set COLUMNS, ROWS and zero-based FRAME. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Row zero starts at the top of the image; V coordinates are reported bottom-up. Texture animation APIs may use their own order.
// Original Incoprea. MIT. Planning only.
integer COLUMNS=4;
integer ROWS=3;
integer FRAME=6;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(COLUMNS<1||ROWS<1||COLUMNS>64||ROWS>64||FRAME<0||FRAME>=COLUMNS*ROWS)
{
llOwnerSay("Invalid atlas dimensions/frame.");
return;
}
integer column=FRAME%COLUMNS;
integer row=FRAME/COLUMNS;
float left=(float)column/(float)COLUMNS;
float right=(float)(column+1)/(float)COLUMNS;
float top=1.0-(float)row/(float)ROWS;
float bottom=1.0-(float)(row+1)/(float)ROWS;
llOwnerSay("Column="+(string)column+" row="+(string)row+" bounds U="+(string)left+".."+(string)right+" V="+(string)bottom+".."+(string)top);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateLocate a touch relative to a sampled rail
Find the closest point on a two-touch rail to a third clicked point.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch rail start, rail end, then a point to compare. Collect 3 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The rail is a finite segment; projection clamps at either endpoint. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=3)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<3)
{
llOwnerSay("Recorded point "+(string)collected+" of 3.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector rail=b-a;
float den=rail*rail;
if(den<0.000001)
{
llOwnerSay("Rail endpoints coincide.");
return;
}
float t=((c-a)*rail)/den;
if(t<0.0)t=0.0;
if(t>1.0)t=1.0;
vector point=a+t*rail;
llOwnerSay("Along fraction="+(string)t+" rail point="+(string)point+" perpendicular/clamped distance="+(string)llVecDist(c,point));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateMatch reference child dimensions
Preview the dimensions of a uniquely named reference part on this child.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Name one other child reference_size. Use nonphysical child; owner-touch applies/restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Copies bounding dimensions, not geometry, rotation, material or mesh shape.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
vector home;
default
{
state_entry()
{
home=llGetScale();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS))return;
preview=!preview;
if(preview)
{
integer i;
integer target;
integer count;
for(i=2;i<=llGetNumberOfPrims();++i)if(i!=llGetLinkNumber()&&llGetLinkName(i)=="reference_size")
{
target=i;
++count;
}
if(count!=1)
{
preview=FALSE;
llOwnerSay("Need one other reference_size child.");
return;
}
llSetScale(llList2Vector(llGetLinkPrimitiveParams(target,[PRIM_SIZE]),0));
}
else
{
llSetScale(home);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateMatch texture density across surfaces
Convert a desired pixels-per-metre density into repeat counts for a rectangular surface.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set surface size, source image dimensions, and target density. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Assumes conventional rectangular UV mapping. Mesh UV islands and viewer texture limits may prevent the target density.
// Original Incoprea. MIT. Planning only.
float W=5.0;
float H=3.0;
float PIXELS_W=1024.0;
float PIXELS_H=1024.0;
float PIXEL_DENSITY=256.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(W<=0.0||H<=0.0||PIXELS_W<=0.0||PIXELS_H<=0.0||PIXEL_DENSITY<=0.0)
{
llOwnerSay("Positive values required.");
return;
}
llOwnerSay("Suggested repeats U="+(string)(W*PIXEL_DENSITY/PIXELS_W)+" V="+(string)(H*PIXEL_DENSITY/PIXELS_H));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateMatch wheel rotation to distance traveled
Convert accumulated signed path distance into wheel angle modulo a revolution.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive RADIUS and signed DISTANCE. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Assumes rolling without slip; actual simulated wheel contact may differ.
// Original Incoprea. MIT. Planning only.
float RADIUS=0.5;
float DISTANCE=7.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RADIUS<=0.0)
{
llOwnerSay("Positive radius required.");
return;
}
float radians=DISTANCE/RADIUS;
float phase=radians-TWO_PI*llFloor(radians/TWO_PI);
llOwnerSay("Total turns="+(string)(radians/TWO_PI)+" phase degrees="+(string)(phase*RAD_TO_DEG));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateMeasure a circle fitting a clicked triangle
Calculate the incenter and incircle radius from three live corner measurements.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch three triangle vertices. Collect 3 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The center and radius belong to the mathematical triangle, not a curved patch. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=3)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<3)
{
llOwnerSay("Recorded point "+(string)collected+" of 3.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float sideA=llVecDist(b,c);
float sideB=llVecDist(a,c);
float sideC=llVecDist(a,b);
float perimeter=sideA+sideB+sideC;
float twiceArea=llVecMag((b-a)%(c-a));
if(perimeter<0.000001||twiceArea<0.000001)
{
llOwnerSay("Degenerate triangle.");
return;
}
llOwnerSay("Incenter="+(string)((sideA*a+sideB*b+sideC*c)/perimeter)+" radius="+(string)(twiceArea/perimeter));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateMeasure a circular arc from three touches
Estimate the radius of the circle through three sampled points.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch three separated points around a circular edge. Collect 3 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The three points define a circle in3D. Near-collinear clicks make the radius unstable. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=3)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<3)
{
llOwnerSay("Recorded point "+(string)collected+" of 3.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float ab=llVecDist(a,b);
float bc=llVecDist(b,c);
float ca=llVecDist(c,a);
float twiceArea=llVecMag((b-a)%(c-a));
if(twiceArea<0.000001)
{
llOwnerSay("Points are nearly collinear.");
return;
}
llOwnerSay("Fitted radius="+(string)(ab*bc*ca/(2.0*twiceArea)));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateMeasure a clicked line’s compass bearing
Report the bearing from the first touch to the second in a north-zero clockwise convention.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch two points whose horizontal positions differ. Collect 2 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Region+Y is north and+X east. This does not read avatar heading. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=2)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<2)
{
llOwnerSay("Recorded point "+(string)collected+" of 2.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector delta=b-a;
delta.z=0.0;
if(llVecMag(delta)<0.000001)
{
llOwnerSay("No horizontal separation.");
return;
}
float degrees=llAtan2(delta.x,delta.y)*RAD_TO_DEG;
if(degrees<0.0)degrees+=360.0;
llOwnerSay("North-clockwise bearing="+(string)degrees+" degrees");
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateMeasure a corner with three touches
Measure the interior angle formed by three real surface points.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch one edge point, the corner, then the other edge point. Collect 3 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The middle touch is the angle vertex. Repeated points are rejected. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=3)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<3)
{
llOwnerSay("Recorded point "+(string)collected+" of 3.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector u=a-b;
vector v=c-b;
if(llVecMag(u)<0.000001||llVecMag(v)<0.000001)
{
llOwnerSay("Repeated corner point.");
return;
}
float dot=llVecNorm(u)*llVecNorm(v);
if(dot>1.0)dot=1.0;
if(dot< -1.0)dot=-1.0;
llOwnerSay("Corner degrees="+(string)(llAcos(dot)*RAD_TO_DEG));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateMeasure a five-point traced feature
Calculate the length and directness of a four-segment manually traced path.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch five ordered points along the feature. Collect 5 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Straight segment sums underestimate curved paths. Touches are not automatically captured during a drag. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=5)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<5)
{
llOwnerSay("Recorded point "+(string)collected+" of 5.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float length;
integer i;
for(i=1;i<5;++i)length+=llVecDist(llList2Vector(points,i-1),llList2Vector(points,i));
float direct=llVecDist(a,llList2Vector(points,4));
llOwnerSay("Traced length="+(string)length+" endpoint distance="+(string)direct);
if(length>0.000001)llOwnerSay("Directness="+(string)(direct/length));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateMeasure a four-corner surface patch
Calculate two triangle areas across a chosen quadrilateral diagonal.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch four corners around the boundary in order. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Assumes a simple roughly planar patch and uses diagonal0-to2; concave or twisted patches need care. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float first=0.5*llVecMag((b-a)%(c-a));
float second=0.5*llVecMag((c-a)%(d-a));
llOwnerSay("Triangulated patch area="+(string)(first+second)+" triangles="+(string)first+","+(string)second);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · AdvancedMeasure a model’s traveled path
Accumulate sampled travel distance and compare it with net displacement during one bounded session.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Move your own model with Edit or its existing animation. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
One-second samples underestimate curved or rapid paths. Stops when region coordinates change; does not track avatars.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
vector origin;
vector previous;
vector region;
float distance;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
llOwnerSay("Sampled travel="+(string)distance+" m; net displacement="+(string)llVecDist(origin,previous)+" m; elapsed="+(string)(llGetTime()-began));
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
origin=llGetRootPosition();
previous=origin;
region=llGetRegionCorner();
distance=0.0;
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
if(llGetRegionCorner()!=region)
{
llOwnerSay("Region changed; stopping before coordinate discontinuity.");
finish();
return;
}
vector current=llGetRootPosition();
distance += llVecDist(previous,current);
previous=current;
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5 · API reference 6
Building helpers · IntermediateMeasure a plane’s tilt from horizontal
Use a three-point plane to calculate its unsigned tilt relative to world horizontal.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch three noncollinear points on a planar surface. Collect 3 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Reversing winding does not change the reported tilt. A vertical plane reports90 degrees. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=3)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<3)
{
llOwnerSay("Recorded point "+(string)collected+" of 3.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector normal=(b-a)%(c-a);
if(llVecMag(normal)<0.000001)
{
llOwnerSay("Collinear samples.");
return;
}
normal=llVecNorm(normal);
float z=llFabs(normal.z);
if(z>1.0)z=1.0;
llOwnerSay("Plane tilt degrees="+(string)(llAcos(z)*RAD_TO_DEG)+" normal="+(string)normal);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5 · API reference 6
Building helpers · IntermediateMeasure a point’s height above a sampled plane
Fit a plane through the first three touches and measure the fourth point’s signed distance.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch three noncollinear plane points, then the point to compare. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Normal direction follows the first triple’s winding. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector normal=(b-a)%(c-a);
if(llVecMag(normal)<0.000001)
{
llOwnerSay("First three points are collinear.");
return;
}
normal=llVecNorm(normal);
float height=(d-a)*normal;
llOwnerSay("Signed height="+(string)height+" projected point="+(string)(d-height*normal));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · AdvancedMeasure a scripted point light’s sampled duty
Estimate enabled time and time-weighted intensity of this prim’s point light.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Start while an existing light-control script runs. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
Uses previous sampled state over each elapsed interval; short flashes can be missed. This is not electrical energy or measured illumination.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
integer wasOn;
float intensity;
float prior;
float onTime;
float exposure;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
float duration=prior-began;
float duty=0.0;
if(duration>0.0)duty=onTime/duration;
llOwnerSay("Sampled on-seconds="+(string)onTime+" duty fraction="+(string)duty+" intensity-seconds="+(string)exposure);
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
list light=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_POINT_LIGHT]);
wasOn=llList2Integer(light,0);
intensity=llList2Float(light,2);
prior=llGetTime();
onTime=0.0;
exposure=0.0;
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
float now=llGetTime();
float dt=now-prior;
if(wasOn)
{
onTime += dt;
exposure += dt*intensity;
}
list light=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_POINT_LIGHT]);
wasOn=llList2Integer(light,0);
intensity=llList2Float(light,2);
prior=now;
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateMeasure a signed fold about a shared edge
Calculate the signed dihedral angle between face normals around a chosen hinge edge.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set nonzero NORMAL_A/NORMAL_B and shared EDGE direction. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
The edge must lie in both face planes. Reversing the edge reverses the signed fold direction.
// Original Incoprea. MIT. Planning only.
vector NORMAL_A=<0.0,0.0,1.0>;
vector NORMAL_B=<0.0,0.7071068,0.7071068>;
vector EDGE=<1.0,0.0,0.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llVecMag(NORMAL_A)<0.000001||llVecMag(NORMAL_B)<0.000001||llVecMag(EDGE)<0.000001)
{
llOwnerSay("Nonzero vectors required.");
return;
}
vector a=llVecNorm(NORMAL_A);
vector b=llVecNorm(NORMAL_B);
vector edge=llVecNorm(EDGE);
if(llFabs(a*edge)>0.001||llFabs(b*edge)>0.001)
{
llOwnerSay("Edge must be perpendicular to both normals.");
return;
}
llOwnerSay("Signed fold degrees="+(string)(llAtan2(edge*(a%b),a*b)*RAD_TO_DEG));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateMeasure a tetrahedral corner volume
Compute the volume enclosed by four clicked vertices.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch four noncoplanar points. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
This is the tetrahedron through those samples, not the volume of the whole mesh. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float volume=llFabs((b-a)*((c-a)%(d-a)))/6.0;
llOwnerSay("Tetrahedron volume="+(string)volume);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateMeasure a triangular surface patch
Calculate area and perimeter from three clicked corners.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch the three corners of a triangular patch. Collect 3 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
Uses the planar triangle through the clicks; a curved surface may have greater true area. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=3)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<3)
{
llOwnerSay("Recorded point "+(string)collected+" of 3.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
float area=0.5*llVecMag((b-a)%(c-a));
float perimeter=llVecDist(a,b)+llVecDist(b,c)+llVecDist(c,a);
llOwnerSay("Triangle area="+(string)area+" perimeter="+(string)perimeter);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · AdvancedMeasure accumulated orientation travel
Accumulate shortest sampled orientation changes and record peak sampled angular speed.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Rotate the actual model with Edit or server-side animation. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
Viewer-only target omega may not appear. Motion over180 degrees between samples is ambiguous; this is not a turn counter.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
rotation previous;
float previousTime;
float totalAngle;
float peak;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
llOwnerSay("Sampled angular travel degrees="+(string)(totalAngle*RAD_TO_DEG)+" peak degrees/sec="+(string)(peak*RAD_TO_DEG));
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
previous=llGetRot();
previousTime=llGetTime();
totalAngle=0.0;
peak=0.0;
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
rotation current=llGetRot();
float now=llGetTime();
float angle=llAngleBetween(previous,current);
float dt=now-previousTime;
totalAngle += angle;
if(dt>0.0&&angle/dt>peak)peak=angle/dt;
previous=current;
previousTime=now;
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5 · API reference 6
Building helpers · IntermediateMeasure rise, run and slope between two touches
Separate a clicked segment into vertical rise and horizontal run.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch the start and end of a ramp or walkway. Collect 2 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The result uses worldZ as vertical and reports signed uphill/downhill grade. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=2)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<2)
{
llOwnerSay("Recorded point "+(string)collected+" of 2.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector delta=b-a;
float run=llSqrt(delta.x*delta.x+delta.y*delta.y);
llOwnerSay("Rise="+(string)delta.z+" run="+(string)run+" length="+(string)llVecMag(delta));
if(run>0.000001)llOwnerSay("Grade percent="+(string)(100.0*delta.z/run)+" angle="+(string)(llAtan2(delta.z,run)*RAD_TO_DEG));
else llOwnerSay("Vertical segment: grade undefined.");
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateMeasure rotation since a bookmark
First touch records orientation; later touches report the angular change in degrees.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed prim and touch as owner before and after rotating it.
Stop / restore: Remove or disable. This inspector changes no build properties.
No rotation is applied. Uses quaternion angular difference, not a subtraction of Euler angles. Reset discards the bookmark.
// Original Incoprea example. MIT.
rotation original;
integer ready;
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed prim.");
return;
}
if(!ready)
{
original=llGetRot();
ready=TRUE;
llOwnerSay("Orientation bookmarked.");
return;
}
llOwnerSay("Angular change: "+(string)(llAngleBetween(original,llGetRot())*RAD_TO_DEG)+" degrees.");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateMeasure scale changes against baseline
Record scale on first touch and report per-axis size ratios on later touches.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the inspected prim. Touch as owner before and after resizing.
Stop / restore: Remove or disable. This inspector changes no build properties.
Uses prim scale, not mesh visible dimensions. It does not restore or enforce the baseline. Reset forgets the bookmark.
// Original Incoprea example. MIT.
vector original;
integer ready;
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
vector current=llGetScale();
if(!ready)
{
original=current;
ready=TRUE;
llOwnerSay("Scale baseline: "+(string)original);
return;
}
if(original.x<=0.0 || original.y<=0.0 || original.z<=0.0)
{
llOwnerSay("Invalid baseline.");
return;
}
vector ratios=<current.x/original.x,current.y/original.y,current.z/original.z>;
llOwnerSay("Scale ratios X/Y/Z: "+(string)ratios);
llOwnerSay("Size delta: "+(string)(current-original));
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateMeasure shortest distance between two infinite guide lines
Find the separation between two lines defined by four touches.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch first line start/end, then second line start/end. Collect 4 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
The lines are infinite; closest positions can lie beyond clicked segments. Parallel lines use perpendicular point-to-line distance. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=4)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<4)
{
llOwnerSay("Recorded point "+(string)collected+" of 4.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector u=b-a;
vector v=d-c;
if(llVecMag(u)<0.000001||llVecMag(v)<0.000001)
{
llOwnerSay("Repeated endpoint.");
return;
}
vector normal=u%v;
float length=llVecMag(normal);
float distance;
if(length<0.000001)distance=llVecMag((c-a)%u)/llVecMag(u);
else distance=llFabs((c-a)*normal)/length;
llOwnerSay("Infinite guide-line separation="+(string)distance);
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · BeginnerMeasure this prim
Report the width, depth, and height of the prim containing the script.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the prim to inspect; touch as its owner.
Stop / restore: Remove or disable the script. It does not change the build.
These are the prim scale settings, not the visible bounds of a mesh or the whole linkset.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
vector size = llGetScale();
llOwnerSay("Prim size in meters: " + (string)size);
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · AdvancedMirror a child position across a local plane
Reflect a child center across a plane defined in root-local coordinates.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Set NORMAL and PLANE_POINT. Owner-touch the child to preview; touch again to restore.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Mirrors position only; it does not reverse mesh handedness or reflect orientation. The original position, rotation and size are restored together.
// Original Incoprea. MIT. Test on a spare copy first.
integer selected;
key identity;
list original;
vector NORMAL=<1.0,0.0,0.0>;
vector PLANE_POINT=ZERO_VECTOR;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
if(selected)
{
if(llGetLinkKey(selected)==identity)llSetLinkPrimitiveParamsFast(selected,[PRIM_POS_LOCAL,llList2Vector(original,0),PRIM_ROT_LOCAL,llList2Rot(original,1),PRIM_SIZE,llList2Vector(original,2)]);
else llOwnerSay("Topology changed; restore manually from backup.");
selected=0;
return;
}
integer link=llDetectedLinkNumber(0);
if(link<2||link>llGetObjectPrimCount(llGetKey()))
{
llOwnerSay("Touch a child prim.");
return;
}
list data=llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL,PRIM_SIZE]);
vector p=llList2Vector(data,0);
rotation r=llList2Rot(data,1);
vector size=llList2Vector(data,2);
if(llVecMag(NORMAL)<0.001)return;
vector normal=llVecNorm(NORMAL);
p=p-2.0*((p-PLANE_POINT)*normal)*normal;
selected=link;
identity=llGetLinkKey(link);
original=data;
llSetLinkPrimitiveParamsFast(link,[PRIM_POS_LOCAL,p,PRIM_ROT_LOCAL,r,PRIM_SIZE,size]);
llOwnerSay("Preview applied; touch again to restore.");
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateMiter extension at a path corner
Calculate the outer offset intersection distance for two equal-width path strips.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set bend angle0..170 degrees and positive half-width. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Sharp bends create long miters; the example reports a miter-limit ratio before actual construction.
// Original Incoprea. MIT. Calculation only.
float BEND=70.0;
float HALF_WIDTH=0.8;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(BEND<0.0||BEND>=170.0||HALF_WIDTH<=0.0)
{
llOwnerSay("Invalid angle/width.");
return;
}
float length=HALF_WIDTH/llCos(BEND*DEG_TO_RAD*0.5);
llOwnerSay("Miter length="+(string)length+" ratio="+(string)(length/HALF_WIDTH)+" outer extension="+(string)(HALF_WIDTH*llTan(BEND*DEG_TO_RAD*0.5)));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateNeutralize ordinary prim twist
Temporarily remove box, cylinder or prism twist while preserving other shape fields.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a nonphysical ordinary prim. Touch compares/restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Separates deformation from rotation. Mesh/sculpt and other types rejected.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
list saved;
default
{
state_entry()
{
saved=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE]);
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer type=llList2Integer(saved,0);
if(llGetStatus(STATUS_PHYSICS)||(type!=PRIM_TYPE_BOX&&type!=PRIM_TYPE_CYLINDER&&type!=PRIM_TYPE_PRISM))return;
preview=!preview;
if(preview)
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TYPE]+llListReplaceList(saved,[ZERO_VECTOR],4,4));
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TYPE]+saved);
}
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateNumber a grid in a continuous snake
Convert a sequence index into rows and columns with alternating row direction.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set COLUMNS, ROWS and cell spacing; total cells at most16. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Useful for scan paths and ordered installations; output stays in one plane and includes cell centers.
// Original Incoprea. MIT. Planning only.
integer COLUMNS=4;
integer ROWS=3;
float SPACING=1.5;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(COLUMNS<1||ROWS<1||COLUMNS*ROWS>16||SPACING<=0.0)
{
llOwnerSay("Use1..16 total cells and positive spacing.");
return;
}
integer i;
for(i=0;i<COLUMNS*ROWS;++i)
{
integer row=i/COLUMNS;
integer column=i%COLUMNS;
if(row%2)column=COLUMNS-1-column;
llOwnerSay((string)i+": "+(string)<column*SPACING,row*SPACING,0.0>);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateNumber tiles outward from a central tile
Generate the first sixteen square-spiral grid coordinates.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set positive SPACING. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
The walk expands right/up/left/down in pairs of growing run lengths; it is a placement plan only.
// Original Incoprea. MIT. Planning only.
float SPACING=1.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SPACING<=0.0)
{
llOwnerSay("Positive spacing required.");
return;
}
integer x;
integer y;
integer direction;
integer run=1;
integer printed=1;
llOwnerSay("0: "+(string)ZERO_VECTOR);
while(printed<16)
{
integer pair;
for(pair=0;pair<2&&printed<16;++pair)
{
integer step;
for(step=0;step<run&&printed<16;++step)
{
if(direction==0)++x;
else if(direction==1)++y;
else if(direction==2)--x;
else --y;
llOwnerSay((string)printed+": "+(string)<x*SPACING,y*SPACING,0.0>);
++printed;
}
direction=(direction+1)%4;
}
++run;
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateOffset a polyline corner by width
Intersect two offset edge lines at one path corner.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set noncollinear XY points PREV/CORNER/NEXT and signed OFFSET. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Positive offset is left of travel. Nearly parallel offset lines are rejected; sharp corners may require beveling.
// Original Incoprea. MIT. Calculation only.
vector PREV=<0.0,0.0,0.0>;
vector CORNER=<5.0,0.0,0.0>;
vector NEXT=<7.0,4.0,0.0>;
float OFFSET=0.5;
float cross2(vector a,vector b)
{
return a.x*b.y-a.y*b.x;
}
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
vector d1=CORNER-PREV;
vector d2=NEXT-CORNER;
d1.z=0.0;
d2.z=0.0;
if(llVecMag(d1)<0.000001||llVecMag(d2)<0.000001)
{
llOwnerSay("Repeated vertex.");
return;
}
d1=llVecNorm(d1);
d2=llVecNorm(d2);
vector p=CORNER+OFFSET*<-d1.y,d1.x,0.0>;
vector q=CORNER+OFFSET*<-d2.y,d2.x,0.0>;
float den=cross2(d1,d2);
if(llFabs(den)<0.000001)
{
llOwnerSay("Parallel corner; handle straight path separately.");
return;
}
llOwnerSay("Offset corner="+(string)(p+d1*(cross2(q-p,d2)/den)));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateOrder exhibits by distance from a point
Sort provided exhibit coordinates by squared distance while retaining original indexes.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set POINTS and CENTRE. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
The strided sort key is consistently float; equal-distance ties may use implementation-dependent order.
// Original Incoprea. MIT. Planning only.
list POINTS=[<4.0,0.0,0.0>,<1.0,1.0,0.0>,<2.0,3.0,0.0>];
vector CENTRE=ZERO_VECTOR;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
list rows;
integer i;
for(i=0;i<llGetListLength(POINTS);++i)
{
vector delta=llList2Vector(POINTS,i)-CENTRE;
rows+=[delta*delta,i];
}
rows=llListSort(rows,2,TRUE);
for(i=0;i<llGetListLength(rows);i+=2)llOwnerSay("Index="+(string)llList2Integer(rows,i+1)+" distance="+(string)llSqrt(llList2Float(rows,i)));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateOrdinary-prim hollow preview
Compare a solid ordinary prim with a fifty-percent hollow profile.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a nonphysical box, cylinder or prism; owner-touch toggles.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Keeps the saved hole shape, cuts, twist and other shape fields. Does not apply to mesh/sculpt prims; collision geometry changes.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
list saved;
default
{
state_entry()
{
saved=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE]);
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetStatus(STATUS_PHYSICS))return;
integer type=llList2Integer(saved,0);
if(type!=PRIM_TYPE_BOX&&type!=PRIM_TYPE_CYLINDER&&type!=PRIM_TYPE_PRISM)return;
preview=!preview;
if(preview)
{
list shape=llListReplaceList(saved,[0.5],3,3);
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TYPE]+shape);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TYPE]+saved);
}
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediatePack display points on a triangular lattice
Generate three staggered rows with equilateral nearest-neighbor spacing.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set positive SPACING. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
This is a triangular point lattice, useful for dense round-item arrangements; it does not check actual object footprints.
// Original Incoprea. MIT. Planning only.
float SPACING=1.2;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SPACING<=0.0)
{
llOwnerSay("Positive spacing required.");
return;
}
integer row;
integer column;
for(row=0;row<3;++row)for(column=0;column<4;++column)
{
float offset=0.0;
if(row%2)offset=0.5;
llOwnerSay((string)<SPACING*(column+offset),SPACING*llSqrt(3.0)*0.5*row,0.0>);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · BeginnerPaged link directory
List up to ten prim link numbers and names per owner touch.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a rezzed linkset or attachment. Touch repeatedly to move through the prims.
Stop / restore: Remove or disable the script. It does not change the build.
Seated avatars are excluded for rezzed objects. Relinking resets the page. Names need not be unique.
// Original Incoprea example. MIT.
integer cursor = 1;
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
integer total = llGetObjectPrimCount(llGetKey());
if (total == 0) total = llGetNumberOfPrims();
if (total == 1)
{
llOwnerSay("This prim: " + llGetObjectName());
return;
}
if (cursor > total) cursor = 1;
integer end = cursor + 9;
if (end > total) end = total;
integer i;
for (i = cursor; i <= end; ++i)
llOwnerSay((string)i + ": " + llGetLinkName(i));
cursor = end + 1;
}
changed(integer flags)
{
if (flags & (CHANGED_LINK | CHANGED_OWNER)) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · AdvancedPause and restore visual linked rotation
Capture each prim’s target-omega settings, set them to zero, then restore the saved settings on the next touch.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Use at most32 actual prims. Stop scripts that would reapply rotation. Owner-touch toggles pause.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Pauses viewer-side target omega only. It does not freeze physics, KFM or timer-driven pose changes. Restoring resumes speed, not the former visual phase.
// Original Incoprea. MIT. Test on a spare copy first.
list saved;
integer active;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
integer i;
if(active)
{
for(i=0;i<llGetListLength(saved);i+=5)
{
integer link=llList2Integer(saved,i);
if(llGetLinkKey(link)==llList2Key(saved,i+1))llSetLinkPrimitiveParamsFast(link,[PRIM_OMEGA]+llList2List(saved,i+2,i+4));
else llOwnerSay("Skipped changed link.");
}
active=FALSE;
saved=[];
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2||total>32)return;
for(i=1;i<=total;++i)
{
saved += [i,llGetLinkKey(i)]+llGetLinkPrimitiveParams(i,[PRIM_OMEGA]);
llSetLinkPrimitiveParamsFast(i,[PRIM_OMEGA,ZERO_VECTOR,0.0,0.0]);
}
active=TRUE;
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlace evenly spaced markers along a route
Print six equal-distance positions on a multi-segment path.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set POINTS with at least two positions. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Duplicate points are allowed, but total route length must be positive. This plans positions without creating markers.
// Original Incoprea. MIT. Calculation only.
list POINTS=[<0.0,0.0,0.0>,<4.0,0.0,0.0>,<4.0,6.0,0.0>,<8.0,6.0,0.0>];
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(POINTS);
if(n<2)
{
llOwnerSay("Need two points.");
return;
}
float total;
integer i;
for(i=1;i<n;++i)total+=llVecDist(llList2Vector(POINTS,i-1),llList2Vector(POINTS,i));
if(total<0.000001)
{
llOwnerSay("Zero-length path.");
return;
}
integer marker;
for(marker=0;marker<6;++marker)
{
float remaining=total*(float)marker/5.0;
vector result=llList2Vector(POINTS,-1);
integer found;
for(i=1;i<n&&!found;++i)
{
vector a=llList2Vector(POINTS,i-1);
vector b=llList2Vector(POINTS,i);
float length=llVecDist(a,b);
if(length>0.0&&remaining<=length)
{
result=a+(b-a)*(remaining/length);
found=TRUE;
}
else remaining-=length;
}
llOwnerSay("Marker "+(string)marker+" "+(string)result);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlace small items on bounded shelves
Use first-fit shelf packing for a list of item widths and a fixed shelf capacity.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive widths no larger than CAPACITY; at most twenty items. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
One-dimensional width packing with no gaps; first-fit is a heuristic and may use more shelves than an optimal arrangement.
// Original Incoprea. MIT. Planning only.
list WIDTHS=[3.0,2.0,4.0,1.5,2.5,1.0];
float CAPACITY=6.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(WIDTHS);
if(n>20||CAPACITY<=0.0)
{
llOwnerSay("Invalid capacity/count.");
return;
}
list used;
integer i;
for(i=0;i<n;++i)
{
float width=llList2Float(WIDTHS,i);
if(width<=0.0||width>CAPACITY)
{
llOwnerSay("Invalid item width.");
return;
}
integer shelf=0;
integer placed=FALSE;
while(shelf<llGetListLength(used)&&!placed)
{
float consumed=llList2Float(used,shelf);
if(consumed+width<=CAPACITY)
{
llOwnerSay("Item "+(string)i+" shelf "+(string)shelf+" x="+(string)consumed);
used=llListReplaceList(used,[consumed+width],shelf,shelf);
placed=TRUE;
}
else ++shelf;
}
if(!placed)
{
llOwnerSay("Item "+(string)i+" new shelf "+(string)llGetListLength(used));
used+=[width];
}
}
llOwnerSay("Shelf loads="+llDumpList2String(used,","));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlan a crossed belt route
Calculate ideal crossed-belt length between two pulley circles.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set radii and center distance greater than their sum. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Crossed belts reverse relative rotation; a real belt needs clearance where it crosses. This is geometry only.
// Original Incoprea. MIT. Planning only.
float R1=1.5;
float R2=1.0;
float DISTANCE=6.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(R1<=0.0||R2<=0.0||DISTANCE<=R1+R2)
{
llOwnerSay("Pulleys need sufficient separation.");
return;
}
float sum=R1+R2;
float angle=llAsin(sum/DISTANCE);
float straight=llSqrt(DISTANCE*DISTANCE-sum*sum);
llOwnerSay("Crossed length="+(string)(2.0*straight+(PI+2.0*angle)*sum)+" wrap degrees="+(string)((PI+2.0*angle)*RAD_TO_DEG));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlan a nine-slice border layout
Calculate three columns and rows for a panel with fixed border widths.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set outer width/height and left/right/top/bottom border sizes. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Returns dimensions, not rendered panels. Opposing borders cannot exceed the outer span.
// Original Incoprea. MIT. Planning only.
float W=6.0;
float H=4.0;
float LEFT=0.4;
float RIGHT=0.6;
float TOP=0.5;
float BOTTOM=0.3;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(LEFT<0.0||RIGHT<0.0||TOP<0.0||BOTTOM<0.0||W<=LEFT+RIGHT||H<=TOP+BOTTOM)
{
llOwnerSay("Borders leave no positive centre.");
return;
}
llOwnerSay("Column widths="+(string)<LEFT,W-LEFT-RIGHT,RIGHT>+"; row heights bottom/centre/top="+(string)<BOTTOM,H-TOP-BOTTOM,TOP>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlan a root pivot shift
Calculate a new root world position and adjusted child offsets that preserve child positions.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set SHIFT in root-local meters. Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
A planning calculation only. Assumes root orientation remains unchanged; moving the root geometry itself is intentional. It neither unlinks nor moves anything.
// Original Incoprea example. MIT.
vector SHIFT=<1.0,0.0,0.0>;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
rotation rootRot=llGetRootRotation();
vector rootPos=llGetRootPosition();
llOwnerSay("Proposed root position: "+(string)(rootPos+SHIFT*rootRot));
integer i;
for(i=2;i<=total;++i)
{
vector position=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
llOwnerSay("Child "+(string)i+" proposed offset: "+(string)(position-SHIFT));
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlan a rounded-end platform
Calculate perimeter and area of a stadium shape: rectangle plus two semicircles.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set overall LENGTH greater than WIDTH and positive WIDTH. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Unlike a rounded rectangle, the end radius is exactly half the width.
// Original Incoprea. MIT. Calculation only.
float LENGTH=12.0;
float WIDTH=5.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(WIDTH<=0.0||LENGTH<WIDTH)
{
llOwnerSay("Need length>=width>0.");
return;
}
float straight=LENGTH-WIDTH;
float radius=WIDTH*0.5;
llOwnerSay("Straight middle length="+(string)straight+" perimeter="+(string)(2.0*straight+TWO_PI*radius)+" area="+(string)(straight*WIDTH+PI*radius*radius));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediatePlan a speed-limited move
Calculate acceleration, cruise and deceleration times for a rest-to-rest straight move.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive DISTANCE, MAX_SPEED and ACCELERATION. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Selects a triangular profile when the move is too short to reach maximum speed. It does not move an object.
// Original Incoprea. MIT. Planning only.
float DISTANCE=12.0;
float MAX_SPEED=3.0;
float ACCELERATION=2.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(DISTANCE<=0.0||MAX_SPEED<=0.0||ACCELERATION<=0.0)
{
llOwnerSay("Positive inputs required.");
return;
}
float ramp=MAX_SPEED/ACCELERATION;
float rampDistance=ACCELERATION*ramp*ramp;
float cruise=0.0;
float peak=MAX_SPEED;
if(DISTANCE<rampDistance)
{
ramp=llSqrt(DISTANCE/ACCELERATION);
peak=ACCELERATION*ramp;
}
else cruise=(DISTANCE-rampDistance)/MAX_SPEED;
llOwnerSay("Accelerate="+(string)ramp+" cruise="+(string)cruise+" decelerate="+(string)ramp+" total="+(string)(2.0*ramp+cruise)+" peak="+(string)peak);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlan an open belt between unequal pulleys
Calculate an ideal open-belt length and each pulley’s wrap angle.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set radii R1/R2 and center distance greater than their absolute difference. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
The formula models tangent straight segments plus contact arcs; pulleys must also avoid physical overlap for a practical arrangement.
// Original Incoprea. MIT. Planning only.
float R1=2.0;
float R2=1.0;
float DISTANCE=6.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(R1<=0.0||R2<=0.0||DISTANCE<=llFabs(R1-R2))
{
llOwnerSay("Invalid pulley layout.");
return;
}
float big=R1;
float small=R2;
if(small>big)
{
float temp=big;
big=small;
small=temp;
}
float angle=llAsin((big-small)/DISTANCE);
float straight=llSqrt(DISTANCE*DISTANCE-(big-small)*(big-small));
float length=2.0*straight+PI*(big+small)+2.0*angle*(big-small);
llOwnerSay("Belt length="+(string)length+" big wrap="+(string)((PI+2.0*angle)*RAD_TO_DEG)+" small wrap="+(string)((PI-2.0*angle)*RAD_TO_DEG));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePlan repeats for a rectangular panel
Calculate horizontal and vertical texture repeats from panel dimensions and desired meters per tile.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set WIDTH, HEIGHT, and METERS_PER_TILE to your measured flat panel values; touch as owner.
Stop / restore: Remove or disable. This inspector changes no build properties.
Read-only planning for a flat rectangular mapping. Mesh UVs and planar mapping may differ; the script does not infer face orientation or apply repeats.
// Original Incoprea example. MIT.
float WIDTH=4.0;
float HEIGHT=2.0;
float METERS_PER_TILE=0.5;
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(WIDTH<=0.0 || HEIGHT<=0.0 || METERS_PER_TILE<=0.0)
{
llOwnerSay("Use positive dimensions and tile size.");
return;
}
vector repeats=<WIDTH/METERS_PER_TILE,HEIGHT/METERS_PER_TILE,0.0>;
llOwnerSay("Suggested repeats: "+(string)repeats);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · BeginnerPosition bookmark
Print the current region, position, and world rotation for your build notes.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed object and touch as owner. Copy the report into your own build notes.
Stop / restore: Remove or disable the script. It does not change the build.
This records nothing permanently by itself and does not move the object. Region coordinates are not global grid coordinates.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
llOwnerSay("Region: " + llGetRegionName());
llOwnerSay("Position: " + (string)llGetPos());
llOwnerSay("World Euler degrees: " + (string)(llRot2Euler(llGetRot()) * RAD_TO_DEG));
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePredict closest approach of two moving points
Calculate the time and separation of closest approach under constant velocities.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set relative POSITION and VELOCITY. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Negative closest time is clamped to now. Only supplied test vectors are used; no sensors or avatar data.
// Original Incoprea. MIT. Planning only.
vector POSITION=<10.0,4.0,0.0>;
vector VELOCITY=<-2.0,-0.2,0.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
float speed2=VELOCITY*VELOCITY;
float t=0.0;
if(speed2>0.000001)t=-(POSITION*VELOCITY)/speed2;
if(t<0.0)t=0.0;
llOwnerSay("Closest future time="+(string)t+" separation="+(string)llVecMag(POSITION+t*VELOCITY));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePreview a root-local placement offset
Convert a planned root-local offset into a region position for placing a separate object.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set OFFSET and use a rezzed build. Touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Reports the target location but does not rez or move anything. Uses the root orientation and position; object scale does not scale the offset.
// Original Incoprea example. MIT.
vector OFFSET=<2.0,0.0,1.0>;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
vector target=llGetRootPosition()+OFFSET*llGetRootRotation();
llOwnerSay("Proposed region position: "+(string)target);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePreview a suspended-cable curve
Sample a symmetric catenary from a selected shape parameter.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set positive SPAN and shape parameter A; supports are atZ0. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
A controls tension-like shape but this is not a structural simulation. Large span/A ratios can overflow and are rejected.
// Original Incoprea. MIT. Calculation only.
float SPAN=8.0;
float A=5.0;
float cosh(float x)
{
return 0.5*(llPow(2.718281828,x)+llPow(2.718281828,-x));
}
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SPAN<=0.0||A<=0.0||SPAN/A>20.0)
{
llOwnerSay("Invalid span/shape ratio.");
return;
}
float edge=cosh(SPAN/(2.0*A));
integer i;
for(i=0;i<=6;++i)
{
float x=-SPAN*0.5+SPAN*(float)i/6.0;
float z=A*(cosh(x/A)-edge);
llOwnerSay((string)<x,0.0,z>);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediatePreview a uniform linkset resize
Report proposed prim scales and child offsets for a uniform scale factor.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set FACTOR from 0.1 through 10. Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
This does not apply scaling. Simulator size, link-distance, mesh physics, and land-impact limits still require testing; warning limits are conservative sample values.
// Original Incoprea example. MIT.
float FACTOR=1.5;
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
if(FACTOR<0.1 || FACTOR>10)
{
llOwnerSay("Factor must be 0.1-10.");
return;
}
integer i;
for(i=1;i<=total;++i)
{
vector size=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_SIZE]),0)*FACTOR;
llOwnerSay("Link "+(string)i+" scale -> "+(string)size);
if(size.x<0.01 || size.y<0.01 || size.z<0.01 || size.x>64 || size.y>64 || size.z>64)llOwnerSay("Review simulator size limits for this prim.");
if(i>1)
{
vector offset=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
llOwnerSay("Offset -> "+(string)(offset*FACTOR));
}
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediatePreview consistent component names
Print a proposed prefix plus link-number name for each real prim.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set PREFIX. Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
No names are changed. Existing name-based scripts could depend on current names, so review their dependencies before manually applying a plan.
// Original Incoprea example. MIT.
string PREFIX="GardenPart";
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
if(PREFIX=="" || llStringLength(PREFIX)>20)
{
llOwnerSay("Use a prefix of 1-20 characters.");
return;
}
integer i;
for(i=1;i<=total;++i)llOwnerSay(llGetLinkName(i)+" -> "+PREFIX+"-"+(string)i);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · AdvancedPreview sequential child component names
Rename children in link order to a numbered family while retaining a reversible snapshot.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Set PREFIX. Limit32 actual prims; owner-touch applies/restores.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Renaming may affect scripts that find parts by name. Disable those scripts first. Root name and inventory names are unchanged.
// Original Incoprea. MIT. Test on a spare copy first.
string PREFIX="Part-";
list saved;
integer active;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
integer i;
if(active)
{
for(i=0;i<llGetListLength(saved);i+=3)
{
integer link=llList2Integer(saved,i);
if(llGetLinkKey(link)==llList2Key(saved,i+1))llSetLinkPrimitiveParamsFast(link,[PRIM_NAME,llList2String(saved,i+2)]);
else llOwnerSay("Skipped changed link="+(string)link);
}
saved=[];
active=FALSE;
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2||total>32||llStringLength(PREFIX)>20)return;
for(i=2;i<=total;++i)
{
saved += [i,llGetLinkKey(i),llGetLinkName(i)];
llSetLinkPrimitiveParamsFast(i,[PRIM_NAME,PREFIX+(string)(i-1)]);
}
active=TRUE;
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediatePrim section-slice preview
Temporarily slice the upper half off a supported ordinary prim for a section study.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a nonphysical ordinary box, cylinder or prism. Owner-touch toggles its slice from startup to the lower half.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Shape and collision geometry change; mesh objects do not use the same slicing behavior. Verify on a copy first.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
list saved;
default
{
state_entry()
{
saved=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_SLICE]);
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetStatus(STATUS_PHYSICS))return;
integer type=llList2Integer(llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TYPE]),0);
if(type!=PRIM_TYPE_BOX&&type!=PRIM_TYPE_CYLINDER&&type!=PRIM_TYPE_PRISM)return;
preview=!preview;
if(preview)
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_SLICE,<0.0,0.5,0.0>]);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_SLICE]+saved);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateProject a build point into planar UVs
Convert an XYZ point into planar texture coordinates using an origin and perpendicular basis axes.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set POINT, ORIGIN, U_AXIS and V_AXIS, each axis scaled to one texture repeat. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Axes must be nonzero and perpendicular. This does not inspect mesh UVs; it plans a projection.
// Original Incoprea. MIT. Planning only.
vector POINT=<3.0,4.0,2.0>;
vector ORIGIN=ZERO_VECTOR;
vector U_AXIS=<2.0,0.0,0.0>;
vector V_AXIS=<0.0,2.0,0.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
float uu=U_AXIS*U_AXIS;
float vv=V_AXIS*V_AXIS;
if(uu<0.000001||vv<0.000001||llFabs(U_AXIS*V_AXIS)>0.0001)
{
llOwnerSay("Use nonzero perpendicular axes.");
return;
}
vector delta=POINT-ORIGIN;
llOwnerSay("Planar UV="+(string)<(delta*U_AXIS)/uu,(delta*V_AXIS)/vv,0.0>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateProject a direction onto a spherical image
Calculate equirectangular UV coordinates from a nonzero direction.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set DIRECTION; longitude seam lies on the negativeX axis. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
The poles have ambiguous longitude. This is one explicit mapping convention and may differ from a mesh UV layout.
// Original Incoprea. MIT. Planning only.
vector DIRECTION=<2.0,3.0,1.0>;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llVecMag(DIRECTION)<0.000001)
{
llOwnerSay("Nonzero direction required.");
return;
}
vector n=llVecNorm(DIRECTION);
float z=n.z;
if(z>1.0)z=1.0;
if(z< -1.0)z=-1.0;
float u=0.5+llAtan2(n.y,n.x)/TWO_PI;
float v=0.5+llAsin(z)/PI;
llOwnerSay("Spherical UV="+(string)<u,v,0.0>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateProject a point around a cylinder
Calculate cylindrical UVs from a point relative to a vertical cylinder center.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set POINT, CENTER, HEIGHT and angular SEAM degrees. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
U wraps around the cylinder; V is measured from center upward. Points on the axis have no unique U.
// Original Incoprea. MIT. Planning only.
vector POINT=<2.0,2.0,3.0>;
vector CENTER=ZERO_VECTOR;
float HEIGHT=4.0;
float SEAM=0.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
vector p=POINT-CENTER;
if(HEIGHT<=0.0||p.x*p.x+p.y*p.y<0.000001)
{
llOwnerSay("Positive height and point off axis required.");
return;
}
float u=(llAtan2(p.y,p.x)-SEAM*DEG_TO_RAD)/TWO_PI;
u-=llFloor(u);
llOwnerSay("Cylindrical UV="+(string)<u,p.z/HEIGHT,0.0>);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateProject child onto an authored rail
Snap a child center to the nearest point on a root-local line segment.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set A and B. Put in nonphysical child; owner-touch previews/restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Centerline alignment, not a moving constraint. Degenerate endpoints rejected.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
vector A=<-1.0,0.0,0.0>;
vector B=<1.0,0.0,0.0>;
vector home;
default
{
state_entry()
{
home=llGetLocalPos();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS)||llVecDist(A,B)<0.001)return;
preview=!preview;
if(preview)
{
vector d=B-A;
float t=((home-A)*d)/(d*d);
if(t<0.0)t=0.0;
if(t>1.0)t=1.0;
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,A+d*t]);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,home]);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateQuick rope sag through three constraints
Print a parabolic span with fixed endpoints and a chosen center sag.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set SPAN positive and SAG nonnegative. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
A parabola is a visual approximation, not the exact hanging-cable catenary. Endpoints areZ0.
// Original Incoprea. MIT. Calculation only.
float SPAN=8.0;
float SAG=1.2;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(SPAN<=0.0||SAG<0.0)
{
llOwnerSay("Invalid span/sag.");
return;
}
integer i;
for(i=0;i<=6;++i)
{
float t=(float)i/6.0;
llOwnerSay((string)<SPAN*t,0.0,-4.0*SAG*t*(1.0-t)>);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateRead a notecard’s first line
Read and display the first line of a notecard in the prim’s inventory.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Add a notecard and set CARD_NAME to its exact inventory name. The script reads the first line after reset.
Stop / restore: Remove the script; clear the floating text if the card has no line.
Demonstration of asynchronous notecard reading. It intentionally reads only one line and exposes it as public hover text.
// Original Incoprea example. Add your own notecard to this prim.
string CARD_NAME = "museum_note";
key query;
default
{
state_entry()
{
if (llGetInventoryType(CARD_NAME) == INVENTORY_NOTECARD)
query = llGetNotecardLine(CARD_NAME, 0);
else
llSetText("Add the museum_note notecard", <1.0, 0.7, 0.5>, 1.0);
}
dataserver(key request, string data)
{
if (request == query)
llSetText(data, <0.85, 0.92, 0.78>, 1.0);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · AdvancedRecord a live resizing envelope
Capture minimum and maximum component dimensions and bounding volume while this prim is resized.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Resize this prim manually or with an existing animation during the session. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
Bounding-box volume is not mesh/material volume. Samples do not include changes that happen entirely between callbacks.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
vector low;
vector high;
float minVolume;
float maxVolume;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
llOwnerSay("Dimension minima="+(string)low+" maxima="+(string)high+" box volume range="+(string)minVolume+" to "+(string)maxVolume);
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
low=llGetScale();
high=low;
minVolume=low.x*low.y*low.z;
maxVolume=minVolume;
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
vector s=llGetScale();
if(s.x<low.x)low.x=s.x;
if(s.y<low.y)low.y=s.y;
if(s.z<low.z)low.z=s.z;
if(s.x>high.x)high.x=s.x;
if(s.y>high.y)high.y=s.y;
if(s.z>high.z)high.z=s.z;
float volume=s.x*s.y*s.z;
if(volume<minVolume)minVolume=volume;
if(volume>maxVolume)maxVolume=volume;
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5
Building helpers · IntermediateRecord an aligned measurement box
Use two opposite clicked points to define region-axis minimum and maximum bounds.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the root of a spare owned object/linkset. Child touch handlers may consume events. Touch opposite corners of the region-aligned area to measure. Collect 2 owner touches; the next touch starts another measurement.
Stop / restore: Reset clears collected points; disable/remove to stop. No geometry is changed.
This constructs an axis-aligned box even if the source object is rotated. Results use actual touch positions in region coordinates, not hidden mesh dimensions.
// Original Incoprea. MIT. Live touch measurements only.
list points;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llDetectedTouchFace(0)<0)
{
llOwnerSay("Touch position unavailable.");
return;
}
if(llGetListLength(points)>=2)points=[];
points+=[llDetectedTouchPos(0)];
integer collected=llGetListLength(points);
if(collected<2)
{
llOwnerSay("Recorded point "+(string)collected+" of 2.");
return;
}
vector a=llList2Vector(points,0);
vector b=llList2Vector(points,1);
vector c=llList2Vector(points,2);
vector d=llList2Vector(points,3);
vector low=a;
vector high=a;
if(b.x<low.x)low.x=b.x;
if(b.y<low.y)low.y=b.y;
if(b.z<low.z)low.z=b.z;
if(b.x>high.x)high.x=b.x;
if(b.y>high.y)high.y=b.y;
if(b.z>high.z)high.z=b.z;
llOwnerSay("Minimum="+(string)low+" maximum="+(string)high+" size="+(string)(high-low));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateRelate two points on a rigid lever
Calculate arc travel at two radii for the same angular turn.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set nonnegative ARM_A/ARM_B and signed ANGLE. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
This reports motion ratios only; it does not calculate real force, efficiency or material strength.
// Original Incoprea. MIT. Planning only.
float ARM_A=1.0;
float ARM_B=3.0;
float ANGLE=15.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(ARM_A<=0.0||ARM_B<=0.0)
{
llOwnerSay("Positive arm lengths required.");
return;
}
float angle=ANGLE*DEG_TO_RAD;
llOwnerSay("Arc travelA="+(string)(ARM_A*angle)+" B="+(string)(ARM_B*angle)+" travel ratio="+(string)(ARM_B/ARM_A));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateRemove near-duplicate route points
Keep route points only when they are at least a selected distance from the last kept point.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set POINTS and nonnegative MIN_DISTANCE. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
The final endpoint is always retained, which may leave a short final segment. This does not preserve sharp corners like a full simplifier.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,0.0,0.0>,<0.02,0.0,0.0>,<1.0,0.0,0.0>,<1.01,0.0,0.0>,<2.0,1.0,0.0>];
float MIN_DISTANCE=0.1;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(POINTS);
if(n==0||MIN_DISTANCE<0.0)
{
llOwnerSay("Need points and nonnegative threshold.");
return;
}
list kept=[llList2Vector(POINTS,0)];
vector last=llList2Vector(POINTS,0);
integer i;
for(i=1;i<n;++i)
{
vector p=llList2Vector(POINTS,i);
if(llVecDist(last,p)>=MIN_DISTANCE||i==n-1)
{
kept+=[p];
last=p;
}
}
llOwnerSay("Kept="+(string)llGetListLength(kept)+": "+llDumpList2String(kept," | "));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · AdvancedReplace faces sharing one diffuse asset
Touch a face to select its existing diffuse asset, then replace all matching faces with a named inventory texture.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put inside a test prim with at most32 faces. Add a texture named replacement with permissions that allow reuse. Owner-touch a face; next touch restores.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Only this prim is edited. Preserves each face’s repeats, offsets and rotation. Does not touch normal, specular or PBR assets.
// Original Incoprea. MIT. Test on a spare copy first.
list saved;
integer active;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer i;
if(active)
{
for(i=0;i<llGetListLength(saved);i+=5)llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TEXTURE,llList2Integer(saved,i)]+llList2List(saved,i+1,i+4));
saved=[];
active=FALSE;
return;
}
integer face=llDetectedTouchFace(0);
if(face<0||llDetectedLinkNumber(0)!=llGetLinkNumber()||llGetNumberOfSides()>32)return;
if(llGetInventoryType("replacement")!=INVENTORY_TEXTURE)
{
llOwnerSay("Add replacement texture.");
return;
}
string asset=llList2String(llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TEXTURE,face]),0);
if((key)asset==NULL_KEY)
{
llOwnerSay("Selected texture key is not readable.");
return;
}
for(i=0;i<llGetNumberOfSides();++i)
{
list data=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_TEXTURE,i]);
if(llList2String(data,0)==asset)
{
saved += [i]+data;
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_TEXTURE,i,"replacement"]+llList2List(data,1,3));
}
}
active=TRUE;
llOwnerSay("Replaced matching faces="+(string)(llGetListLength(saved)/5));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · AdvancedReplace only matching face tints
Preview a palette replacement only on faces close to a specified source tint, preserving alpha.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put inside one test prim with at most32 faces. Set SOURCE_TINT, TARGET_TINT and TOLERANCE; owner-touch toggles preview.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Uses Euclidean RGB distance, not perceptual color distance. Does not change textures or PBR material factors.
// Original Incoprea. MIT. Test on a spare copy first.
vector SOURCE_TINT=<1.0,1.0,1.0>;
vector TARGET_TINT=<0.2,0.7,0.5>;
float TOLERANCE=0.05;
list saved;
integer active;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer i;
if(active)
{
for(i=0;i<llGetListLength(saved);i+=3)llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,llList2Integer(saved,i),llList2Vector(saved,i+1),llList2Float(saved,i+2)]);
saved=[];
active=FALSE;
return;
}
integer faces=llGetNumberOfSides();
if(faces>32||TOLERANCE<0.0||TOLERANCE>0.5)return;
for(i=0;i<faces;++i)
{
list data=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_COLOR,i]);
vector tint=llList2Vector(data,0);
float alpha=llList2Float(data,1);
if(llVecDist(tint,SOURCE_TINT)<=TOLERANCE)
{
saved += [i,tint,alpha];
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR,i,TARGET_TINT,alpha]);
}
}
active=TRUE;
llOwnerSay("Changed faces="+(string)(llGetListLength(saved)/3));
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateReport the child-center envelope
Find minimum and maximum root-local center coordinates of all children.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
This is the envelope of centers only, unlike llGetBoundingBox. It ignores component sizes, shape, root size, and rotation of individual parts.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
vector low=llList2Vector(llGetLinkPrimitiveParams(2,[PRIM_POS_LOCAL]),0);
vector high=low;
integer i;
for(i=3;i<=total;++i)
{
vector p=llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POS_LOCAL]),0);
if(p.x<low.x)low.x=p.x;
if(p.y<low.y)low.y=p.y;
if(p.z<low.z)low.z=p.z;
if(p.x>high.x)high.x=p.x;
if(p.y>high.y)high.y=p.y;
if(p.z>high.z)high.z=p.z;
}
llOwnerSay("Child-center min: "+(string)low+" max: "+(string)high);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateRotate a UV coordinate about a pivot
Apply a two-dimensional rotation to a texture coordinate around a chosen UV center.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set UV, PIVOT and ANGLE degrees. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
The result may leave0..1 and wrap on repeating textures. This is coordinate math, not a prim texture mutation.
// Original Incoprea. MIT. Planning only.
vector UV=<0.2,0.8,0.0>;
vector PIVOT=<0.5,0.5,0.0>;
float ANGLE=30.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
float a=ANGLE*DEG_TO_RAD;
vector q=UV-PIVOT;
vector result=PIVOT+<q.x*llCos(a)-q.y*llSin(a),q.x*llSin(a)+q.y*llCos(a),0.0>;
llOwnerSay("Rotated UV="+(string)result);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateRound a corner with a circular fillet
Calculate tangent setbacks for a circular arc joining two straight runs.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set interior angle1..179 degrees and radius. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
The angle is the interior angle between rays leaving the corner, not the change in travel heading.
// Original Incoprea. MIT. Calculation only.
float INTERIOR=100.0;
float RADIUS=1.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(INTERIOR<=0.0||INTERIOR>=180.0||RADIUS<=0.0)
{
llOwnerSay("Invalid angle/radius.");
return;
}
float half=INTERIOR*DEG_TO_RAD*0.5;
llOwnerSay("Setback along each ray="+(string)(RADIUS/llTan(half))+" centre distance on bisector="+(string)(RADIUS/llSin(half))+" arc sweep degrees="+(string)(180.0-INTERIOR));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateSample an ideal projectile arc
Print five positions under constant gravity from a specified launch velocity.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set START, VELOCITY, GRAVITY and positive DURATION. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
This is ideal kinematics with no collisions or drag. It does not rez or launch a projectile.
// Original Incoprea. MIT. Planning only.
vector START=<0.0,0.0,1.0>;
vector VELOCITY=<4.0,0.0,6.0>;
vector GRAVITY=<0.0,0.0,-9.81>;
float DURATION=1.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(DURATION<=0.0)
{
llOwnerSay("Positive duration required.");
return;
}
integer i;
for(i=0;i<=4;++i)
{
float t=DURATION*(float)i/4.0;
llOwnerSay("t="+(string)t+" position="+(string)(START+VELOCITY*t+0.5*GRAVITY*t*t));
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateSeparate ascent and descent on a route
Sum positive and negative vertical changes independently across a planned path.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set POINTS with two or more positions. Touch for private results.
Stop / restore: Disable/remove; no scene properties change.
Net height change alone hides intermediate climbs; this reports both cumulative directions.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,0.0,0.0>,<2.0,0.0,3.0>,<4.0,0.0,1.0>,<6.0,0.0,4.0>];
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
integer n=llGetListLength(POINTS);
if(n<2)
{
llOwnerSay("Need two points.");
return;
}
float ascent;
float descent;
integer i;
for(i=1;i<n;++i)
{
vector a=llList2Vector(POINTS,i-1);
vector b=llList2Vector(POINTS,i);
float dz=b.z-a.z;
if(dz>0.0)ascent+=dz;
else descent-=dz;
}
llOwnerSay("Ascent="+(string)ascent+" descent="+(string)descent+" net="+(string)(ascent-descent));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateSimulate a damped spring in small steps
Run a bounded semi-implicit Euler spring simulation and report positions.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set positive stiffness, nonnegative damping and target; use the supplied small step size. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
Numerical stability depends on step size and stiffness. The simulation is illustrative and does not drive prim physics.
// Original Incoprea. MIT. Planning only.
float STIFFNESS=12.0;
float DAMPING=5.0;
float TARGET=1.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(STIFFNESS<=0.0||DAMPING<0.0)
{
llOwnerSay("Invalid spring parameters.");
return;
}
float x=0.0;
float velocity=0.0;
float dt=0.02;
integer i;
for(i=0;i<100;++i)
{
float acceleration=STIFFNESS*(TARGET-x)-DAMPING*velocity;
velocity+=acceleration*dt;
x+=velocity*dt;
if((i+1)%20==0)llOwnerSay("t="+(string)((i+1)*dt)+" position="+(string)x+" velocity="+(string)velocity);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateSize a display by viewing angle
Calculate the width a flat display needs to subtend a target horizontal view angle.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set viewing distance positive and angle between0 and170 degrees. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Assumes centered perpendicular viewing. This is geometric planning, not a viewer camera adjustment.
// Original Incoprea. MIT. Calculation only.
float DISTANCE=6.0;
float ANGLE=45.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(DISTANCE<=0.0||ANGLE<=0.0||ANGLE>=170.0)
{
llOwnerSay("Invalid distance/angle.");
return;
}
llOwnerSay("Display width="+(string)(2.0*DISTANCE*llTan(ANGLE*DEG_TO_RAD*0.5)));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateSize a ring-sector floor panel
Calculate area and inner/outer arc lengths for an annular sector.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set outer radius greater than inner radius and sweep0..360 degrees. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Boundary edges are circular; straight-sided mesh approximations have different areas.
// Original Incoprea. MIT. Calculation only.
float OUTER=6.0;
float INNER=3.0;
float SWEEP=45.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(INNER<0.0||OUTER<=INNER||SWEEP<=0.0||SWEEP>360.0)
{
llOwnerSay("Invalid sector.");
return;
}
float angle=SWEEP*DEG_TO_RAD;
llOwnerSay("Area="+(string)(0.5*angle*(OUTER*OUTER-INNER*INNER))+" outer arc="+(string)(angle*OUTER)+" inner arc="+(string)(angle*INNER));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateSlow near a destination
Calculate a distance-dependent arrival speed capped by both preferred speed and stopping distance.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a spare owned prim. Set DISTANCE, PREFERRED_SPEED and DECELERATION. Touch for owner-only output.
Stop / restore: Remove/disable. The script calculates only; no scene properties change.
This is a speed planner only. Repeated control needs measured elapsed time, tolerances and simulator-specific limits.
// Original Incoprea. MIT. Planning only.
float DISTANCE=1.2;
float PREFERRED_SPEED=4.0;
float DECELERATION=2.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(DISTANCE<0.0||PREFERRED_SPEED<0.0||DECELERATION<=0.0)
{
llOwnerSay("Invalid arrival inputs.");
return;
}
float speed=llSqrt(2.0*DECELERATION*DISTANCE);
if(speed>PREFERRED_SPEED)speed=PREFERRED_SPEED;
llOwnerSay("Recommended maximum arrival speed="+(string)speed);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · AdvancedSnap a child to the root-local grid
Round all three child offset coordinates to a configured root-local spacing.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Set positive GRID up to1 meter. Owner-touch the child to preview; touch again to restore.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
This is a one-time actual position preview, not a moving constraint; collision clearance is your responsibility.
// Original Incoprea. MIT. Test on a spare copy first.
integer selected;
key identity;
list original;
float GRID=0.25;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
if(selected)
{
if(llGetLinkKey(selected)==identity)llSetLinkPrimitiveParamsFast(selected,[PRIM_POS_LOCAL,llList2Vector(original,0),PRIM_ROT_LOCAL,llList2Rot(original,1),PRIM_SIZE,llList2Vector(original,2)]);
else llOwnerSay("Topology changed; restore manually from backup.");
selected=0;
return;
}
integer link=llDetectedLinkNumber(0);
if(link<2||link>llGetObjectPrimCount(llGetKey()))
{
llOwnerSay("Touch a child prim.");
return;
}
list data=llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL,PRIM_ROT_LOCAL,PRIM_SIZE]);
vector p=llList2Vector(data,0);
rotation r=llList2Rot(data,1);
vector size=llList2Vector(data,2);
if(GRID<=0.0||GRID>1.0)return;
p=<llRound(p.x/GRID)*GRID,llRound(p.y/GRID)*GRID,llRound(p.z/GRID)*GRID>;
selected=link;
identity=llGetLinkKey(link);
original=data;
llSetLinkPrimitiveParamsFast(link,[PRIM_POS_LOCAL,p,PRIM_ROT_LOCAL,r,PRIM_SIZE,size]);
llOwnerSay("Preview applied; touch again to restore.");
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateSort a ring of points by bearing
Order supplied XY points by their angle around a chosen center.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set POINTS around CENTER. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
Angle sorting does not produce a valid polygon for every arbitrary point cloud; duplicate bearings and interior points need additional handling.
// Original Incoprea. MIT. Planning only.
list POINTS=[<0.0,3.0,0.0>,<-3.0,0.0,0.0>,<3.0,0.0,0.0>,<0.0,-3.0,0.0>];
vector CENTER=ZERO_VECTOR;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
list ordered;
integer i;
for(i=0;i<llGetListLength(POINTS);++i)
{
vector p=llList2Vector(POINTS,i)-CENTER;
if(p.x*p.x+p.y*p.y<0.000001)
{
llOwnerSay("Point at center has no bearing.");
return;
}
ordered+=[llAtan2(p.y,p.x),i];
}
ordered=llListSort(ordered,2,TRUE);
for(i=0;i<llGetListLength(ordered);i+=2)llOwnerSay("Index="+(string)llList2Integer(ordered,i+1)+" angle="+(string)(llList2Float(ordered,i)*RAD_TO_DEG));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateSpace railing posts on an arc
Calculate a post count and angular step to keep arc spacing below a maximum.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set radius, positive sweep up to360 degrees and maximum spacing. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
Both endpoints receive posts. A full circle duplicates the start/end location; omit one endpoint in a closed build.
// Original Incoprea. MIT. Calculation only.
float RADIUS=4.0;
float SWEEP=120.0;
float MAX_SPACING=1.2;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RADIUS<=0.0||SWEEP<=0.0||SWEEP>360.0||MAX_SPACING<=0.0)
{
llOwnerSay("Invalid arc.");
return;
}
float arc=RADIUS*SWEEP*DEG_TO_RAD;
integer intervals=llCeil(arc/MAX_SPACING);
llOwnerSay("Posts="+(string)(intervals+1)+" angle step="+(string)(SWEEP/(float)intervals)+" arc spacing="+(string)(arc/(float)intervals));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateSpread ornaments over a sphere
Print twelve approximately uniform spherical positions using a golden-angle spiral.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set positive RADIUS. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
This avoids latitude-grid pole clustering but does not optimize minimum separation exactly.
// Original Incoprea. MIT. Planning only.
float RADIUS=3.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RADIUS<=0.0)
{
llOwnerSay("Positive radius required.");
return;
}
integer n=12;
float golden=PI*(3.0-llSqrt(5.0));
integer i;
for(i=0;i<n;++i)
{
float z=1.0-2.0*((float)i+0.5)/(float)n;
float ring=llSqrt(1.0-z*z);
float angle=golden*i;
llOwnerSay((string)(RADIUS*<ring*llCos(angle),ring*llSin(angle),z>));
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateSpread seeds across a circular bed
Print twelve sunflower-style positions with radius proportional to the square root of index.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare owned prim. Set positive RADIUS. Owner touch prints sample coordinates.
Stop / restore: Remove/disable. Nothing is rezzed or moved.
An approximately even-area disc pattern, not random sampling. It intentionally excludes a point exactly at the origin.
// Original Incoprea. MIT. Planning only.
float RADIUS=4.0;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(RADIUS<=0.0)
{
llOwnerSay("Positive radius required.");
return;
}
integer n=12;
float angleStep=PI*(3.0-llSqrt(5.0));
integer i;
for(i=0;i<n;++i)
{
float r=RADIUS*llSqrt(((float)i+0.5)/(float)n);
float angle=i*angleStep;
llOwnerSay((string)<r*llCos(angle),r*llSin(angle),0.0>);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4
Building helpers · IntermediateSummarize component role tags
Count exact Description values as role labels across a build.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Descriptions are treated as complete literal role labels. A description used as complex configuration may not make a useful role label; nothing is edited.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
list roles=[];
list counts=[];
integer i;
for(i=1;i<=total;++i)
{
string role=llList2String(llGetLinkPrimitiveParams(i,[PRIM_DESC]),0);
if(role=="")role="[blank]";
integer index=llListFindList(roles,[role]);
if(index==-1)
{
roles += [role];
counts += [1];
}
else counts=llListReplaceList(counts,[llList2Integer(counts,index)+1],index,index);
}
for(i=0;i<llGetListLength(roles);++i)llOwnerSay(llList2String(roles,i)+": "+llList2String(counts,i));
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateSummarize configured face transparency
Count fully opaque, partially transparent, and zero-alpha faces on this prim.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the inspected prim and touch as owner.
Stop / restore: Remove or disable. This inspector changes no build properties.
Only reads legacy face alpha. Texture pixels, alpha modes, and PBR can change actual appearance; zero alpha does not make metadata private.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
integer opaque;
integer partial;
integer clear;
integer face;
for(face=0;face<llGetNumberOfSides();++face)
{
float alpha=llGetAlpha(face);
if(alpha<=0.0) ++clear;
else if(alpha>=1.0) ++opaque;
else ++partial;
}
llOwnerSay("Opaque: "+(string)opaque+"; partial: "+(string)partial+"; alpha zero: "+(string)clear);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateSummarize primitive shape families
Count documented PRIM_TYPE values across this linkset.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed linkset of 2-32 prims and touch as owner.
Stop / restore: Remove or disable. This planner does not apply the reported changes.
Mesh/sculpted objects can appear under the sculpt type family; this is not a mesh topology or polygon-count audit.
// Original Incoprea example. MIT.
default
{
touch_start(integer touches)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed build.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>32)
{
llOwnerSay("Use a linkset of 2-32 prims.");
return;
}
list types=[];
list counts=[];
integer i;
for(i=1;i<=total;++i)
{
integer shape=llList2Integer(llGetLinkPrimitiveParams(i,[PRIM_TYPE]),0);
integer index=llListFindList(types,[shape]);
if(index==-1)
{
types += [shape];
counts += [1];
}
else counts=llListReplaceList(counts,[llList2Integer(counts,index)+1],index,index);
}
for(i=0;i<llGetListLength(types);++i)llOwnerSay("PRIM_TYPE "+llList2String(types,i)+": "+llList2String(counts,i)+" prims");
}
changed(integer flags)
{
if(flags & CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · BeginnerSurface coordinate probe
Display the touched face’s normalized surface and texture coordinates to the owner.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Place in a build and touch its visible surface as owner.
Stop / restore: Remove or disable the script. It does not change the build.
ST is face-space; UV reflects texture mapping. Unsupported touches can return invalid coordinates. This only reports the owner’s deliberate touch.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
integer face = llDetectedTouchFace(0);
if (face == TOUCH_INVALID_FACE)
{
llOwnerSay("Surface data unavailable.");
return;
}
llOwnerSay("Face " + (string)face + " / link " + (string)llDetectedLinkNumber(0));
llOwnerSay("ST: " + (string)llDetectedTouchST(0));
llOwnerSay("UV: " + (string)llDetectedTouchUV(0));
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · AdvancedSwap two chosen child centers
Choose two child prims to exchange their local positions without changing dimensions or rotation.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a spare nonphysical rezzed linkset; disable competing scripts and do not edit or relink during the preview. Put this in the root. Touch first child, second child, then any prim to restore.
Stop / restore: Owner-touch again to restore before removing, resetting, relinking or transferring. Snapshots are memory-only; deletion/reset does not undo changes. Keep an untouched backup.
Moves real geometry. Seated avatars and root are excluded. A changed topology aborts the swap or restore.
// Original Incoprea. MIT. Test on a spare copy first.
integer first;
integer second;
key firstKey;
key secondKey;
vector firstPos;
vector secondPos;
integer active;
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetAttached()||llGetStatus(STATUS_PHYSICS)||llGetLinkNumber()>1)
{
llOwnerSay("Use a nonphysical rezzed root.");
return;
}
if(active)
{
if(llGetLinkKey(first)==firstKey&&llGetLinkKey(second)==secondKey)
{
llSetLinkPrimitiveParamsFast(first,[PRIM_POS_LOCAL,firstPos]);
llSetLinkPrimitiveParamsFast(second,[PRIM_POS_LOCAL,secondPos]);
}
else llOwnerSay("Topology changed; restore manually.");
first=0;
active=FALSE;
return;
}
integer link=llDetectedLinkNumber(0);
if(link<2||link>llGetObjectPrimCount(llGetKey()))return;
if(!first)
{
first=link;
firstKey=llGetLinkKey(link);
firstPos=llList2Vector(llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL]),0);
llOwnerSay("Touch a different child.");
return;
}
if(link==first)return;
if(llGetLinkKey(first)!=firstKey)
{
first=0;
return;
}
second=link;
secondKey=llGetLinkKey(link);
secondPos=llList2Vector(llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL]),0);
llSetLinkPrimitiveParamsFast(first,[PRIM_POS_LOCAL,secondPos]);
llSetLinkPrimitiveParamsFast(second,[PRIM_POS_LOCAL,firstPos]);
active=TRUE;
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · BeginnerThree-axis orientation sign
Show a prim’s position to help while building.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in the object to inspect. Touch to print its region position privately to the owner.
Stop / restore: Disable or remove the script; it does not change object placement.
Reports the prim position in region coordinates. It is not a compass heading or teleport tool.
// Original Incoprea building helper.
default
{
touch_start(integer count)
{
vector p = llGetPos();
llOwnerSay("Position: " + (string)p);
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateThree-bar linked chart
Resize three authored bars from a checked percentage message while retaining their base height.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Name three root-aligned box children bar1,bar2,bar3. Use nonphysical root. Owner-touch arms; root script sends code8062 and three comma-separated integers0–100.
Stop / restore: Owner-touch disarms and restores each position and scale.
Use a spare modifiable build. Snapshot state is held only in script memory; restore before reset/removal. Do not relink during a preview. Zero values retain a0.01m sliver; no automatic physics or link changes. Intended for small exhibit bars, not structural parts.
// Original Incoprea. MIT. Not compiled or tested in-world.
list links;
list saved;
integer active;
integer valid=TRUE;
default
{
state_entry()
{
integer i;
for(i=1;i<=3;++i)
{
integer j;
integer found;
integer count;
for(j=2;j<=llGetObjectPrimCount(llGetKey());++j)if(llGetLinkName(j)=="bar"+(string)i)
{
found=j;
++count;
}
if(count!=1)
{
valid=FALSE;
return;
}
links+=[found];
saved+=llGetLinkPrimitiveParams(found,[PRIM_SIZE,PRIM_POS_LOCAL]);
}
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner()||llGetLinkNumber()>1||llGetStatus(STATUS_PHYSICS)||!valid)return;
active=!active;
if(!active)
{
integer i;
for(i=0;i<3;++i)llSetLinkPrimitiveParamsFast(llList2Integer(links,i),[PRIM_SIZE,llList2Vector(saved,i*2),PRIM_POS_LOCAL,llList2Vector(saved,i*2+1)]);
}
}
link_message(integer sender,integer code,string s,key data)
{
if(!active||!valid||sender!=1||code!=8062||llGetStatus(STATUS_PHYSICS))return;
list values=llCSV2List(s);
if(llGetListLength(values)!=3)return;
integer i;
for(i=0;i<3;++i)
{
string value=llStringTrim(llList2String(values,i),STRING_TRIM);
integer number=(integer)value;
if((string)number!=value||number<0||number>100)return;
}
for(i=0;i<3;++i)
{
vector size=llList2Vector(saved,i*2);
vector p=llList2Vector(saved,i*2+1);
float old=size.z;
size.z*=llList2Integer(values,i)/100.0;
if(size.z<0.01)size.z=0.01;
p.z+=(size.z-old)*0.5;
llSetLinkPrimitiveParamsFast(llList2Integer(links,i),[PRIM_SIZE,size,PRIM_POS_LOCAL,p]);
}
}
changed(integer change)
{
if(change&CHANGED_LINK)
{
valid=FALSE;
active=FALSE;
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateTouch position in root coordinates
Convert an owner-selected surface point from region coordinates into the root’s coordinate system.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use a rezzed object and touch a surface as owner.
Stop / restore: Remove or disable. This inspector changes no build properties.
Attachments are rejected. Point conversion includes translation and inverse rotation; it does not compensate for mesh modelling offsets.
// Original Incoprea example. MIT.
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed object.");
return;
}
if(llDetectedTouchFace(0)==TOUCH_INVALID_FACE)
{
llOwnerSay("Touch surface data unavailable.");
return;
}
vector localPoint=(llDetectedTouchPos(0)-llGetRootPosition())/llGetRootRotation();
llOwnerSay("Root-local point: "+(string)localPoint);
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateTouch-surface crosshair
Move one child marker to the position selected on an authored flat panel.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in root with one child crosshair. Set FACE,WIDTH,HEIGHT for a root-local XY panel whose UV axes match X/Y. Owner-touch panel positions marker; root long-hold restores.
Stop / restore: Hold the root panel for two seconds to restore before removal.
Use a spare modifiable build. Snapshot state is held only in script memory; restore before reset/removal. Do not relink during a preview. UV orientation varies by mesh/face; test authored mapping first. Nonphysical only; Z is preserved from marker Home.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer FACE=0;
float WIDTH=1.0;
float HEIGHT=1.0;
integer target;
integer valid=TRUE;
vector home;
float pressed;
default
{
state_entry()
{
integer i;
integer count;
for(i=2;i<=llGetObjectPrimCount(llGetKey());++i)if(llGetLinkName(i)=="crosshair")
{
target=i;
++count;
}
if(count!=1)
{
valid=FALSE;
return;
}
home=llList2Vector(llGetLinkPrimitiveParams(target,[PRIM_POS_LOCAL]),0);
}
touch_start(integer n)
{
if(llDetectedKey(0)==llGetOwner())pressed=llGetTime();
}
touch_end(integer n)
{
if(llDetectedKey(0)!=llGetOwner()||llGetLinkNumber()>1||llGetStatus(STATUS_PHYSICS)||!valid||llDetectedLinkNumber(0)>1)return;
if(llGetTime()-pressed>=2.0)
{
llSetLinkPrimitiveParamsFast(target,[PRIM_POS_LOCAL,home]);
return;
}
if(llDetectedTouchFace(0)!=FACE)return;
vector st=llDetectedTouchST(0);
if(st.x<0.0||st.y<0.0||st.x>1.0||st.y>1.0)return;
llSetLinkPrimitiveParamsFast(target,[PRIM_POS_LOCAL,<(st.x-0.5)*WIDTH,(st.y-0.5)*HEIGHT,home.z>]);
}
changed(integer change)
{
if(change&CHANGED_LINK)valid=FALSE;
}
}
MIT · original Incoprea example
API reference 1 · API reference 2
Building helpers · IntermediateTrim a corner with a chamfer
Find the two cut points and new diagonal length when beveling a path corner.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a spare owned prim. Set three vertices and a positive setback smaller than both adjacent runs. Touch to print the plan privately.
Stop / restore: Remove/disable; calculations do not alter objects.
The setback is measured along each adjoining segment. No actual mesh is edited.
// Original Incoprea. MIT. Calculation only.
vector A=<0.0,0.0,0.0>;
vector B=<5.0,0.0,0.0>;
vector C=<5.0,4.0,0.0>;
float SETBACK=0.8;
default
{
touch_start(integer detectedCount)
{
if(llDetectedKey(0)!=llGetOwner())return;
float first=llVecDist(A,B);
float second=llVecDist(B,C);
if(SETBACK<=0.0||SETBACK>=first||SETBACK>=second)
{
llOwnerSay("Setback does not fit adjacent runs.");
return;
}
vector p=B+llVecNorm(A-B)*SETBACK;
vector q=B+llVecNorm(C-B)*SETBACK;
llOwnerSay("Cut endpoints="+(string)p+" and "+(string)q+"; chamfer length="+(string)llVecDist(p,q));
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · BeginnerTwo-point touch ruler
Measure the straight-line distance between two owner-selected surface points.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a stationary rezzed build. Touch one surface point, then another point on the same scripted build.
Stop / restore: Remove or reset to forget the first point. No build properties change.
Uses viewer-provided world touch positions. Moving the object between touches changes the meaning of the measurement; results are approximate.
// Original Incoprea example. MIT.
vector first;
integer hasFirst;
default
{
touch_start(integer count)
{
if (llDetectedKey(0) != llGetOwner()) return;
if (llDetectedTouchFace(0) == TOUCH_INVALID_FACE)
{
llOwnerSay("Touch data unavailable; try a visible surface.");
return;
}
vector point = llDetectedTouchPos(0);
if (!hasFirst)
{
first = point;
hasFirst = TRUE;
llOwnerSay("First point saved. Touch the second point.");
}
else
{
llOwnerSay("Distance: " + (string)llVecDist(first, point) + " meters.");
hasFirst = FALSE;
}
}
changed(integer flags)
{
if (flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3
Building helpers · IntermediateUniform fit in display box
Uniformly scale one prim to fit authored unrotated bounding dimensions.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Set BOX dimensions. Use nonphysical child or unlinked prim; touch previews/restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Not a whole-linkset resizer. Checks 0.01–64 meter dimensions; grids may impose other limits.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
vector BOX=<1.0,1.0,1.0>;
vector home;
default
{
state_entry()
{
home=llGetScale();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetStatus(STATUS_PHYSICS)||BOX.x<=0.0||BOX.y<=0.0||BOX.z<=0.0)return;
preview=!preview;
if(preview)
{
float factor=BOX.x/home.x;
if(BOX.y/home.y<factor)factor=BOX.y/home.y;
if(BOX.z/home.z<factor)factor=BOX.z/home.z;
vector size=home*factor;
if(size.x<0.01||size.y<0.01||size.z<0.01||size.x>64.0||size.y>64.0||size.z>64.0)
{
preview=FALSE;
return;
}
llSetScale(size);
}
else
{
llSetScale(home);
}
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateValidate named build components
Check whether a linkset has each required component name exactly once.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in a rezzed linkset of 2-64 prims and touch as owner. Seated avatars are excluded. Edit REQUIRED.
Stop / restore: Remove or disable. This inspector changes no build properties.
This checks names, not function, content, or material. An unexpected extra copy is a finding rather than silently choosing one.
// Original Incoprea example. MIT.
list REQUIRED=["Root","Door","Handle"];
default
{
touch_start(integer count)
{
if(llDetectedKey(0)!=llGetOwner()) return;
if(llGetAttached())
{
llOwnerSay("Use a rezzed linkset.");
return;
}
integer total=llGetObjectPrimCount(llGetKey());
if(total<2 || total>64)
{
llOwnerSay("Use a linkset of 2-64 prims.");
return;
}
integer i;
integer j;
for(i=0;i<llGetListLength(REQUIRED);++i)
{
string wanted=llList2String(REQUIRED,i);
integer matches;
for(j=1;j<=total;++j) if(llGetLinkName(j)==wanted) ++matches;
if(matches==1) llOwnerSay("OK: "+wanted);
else llOwnerSay("Expected one ["+wanted+"], found "+(string)matches);
}
}
changed(integer flags)
{
if(flags & CHANGED_OWNER) llResetScript();
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateVolume-preserving height study
Double height and reduce width/depth to preserve bounding-box volume.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use an ordinary nonphysical prim well within build limits. Owner-touch previews/restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Preserves bounding-box volume, not hollow or arbitrary mesh surface volume.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
vector home;
default
{
state_entry()
{
home=llGetScale();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetStatus(STATUS_PHYSICS))return;
preview=!preview;
if(preview)
{
vector size=<home.x/llSqrt(2.0),home.y/llSqrt(2.0),home.z*2.0>;
if(size.x<0.01||size.y<0.01||size.z>64.0)
{
preview=FALSE;
return;
}
llSetScale(size);
}
else
{
llSetScale(home);
}
}
}
MIT · original Incoprea example
API reference 1
Building helpers · AdvancedWatch component role names during a test
Detect and count linked-child name changes while another maintenance or configuration script operates.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in your own rezzed test object. Put in the root of a rezzed linkset with2–32 actual prims. Owner-touch starts a thirty-sample session; touch again ends early.
Stop / restore: Automatically stops after thirty samples. Disable/remove to stop; no scene properties are changed.
Stops when link keys change, rather than confusing relinked components. Names are only read; reports contain link numbers and change counts.
// Original Incoprea. MIT. Test on a spare copy first.
integer active;
integer samples;
float began;
list keys;
list names;
list counts;
integer total;
finish()
{
llSetTimerEvent(0.0);
active=FALSE;
integer i;
for(i=0;i<llGetListLength(counts);++i)if(llList2Integer(counts,i)>0)llOwnerSay("Link "+(string)(i+2)+" name transitions="+(string)llList2Integer(counts,i));
llOwnerSay("Component-name watch finished.");
}
default
{
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(active)
{
finish();
return;
}
samples=0;
began=llGetTime();
if(llGetAttached()||llGetLinkNumber()>1)return;
total=llGetObjectPrimCount(llGetKey());
if(total<2||total>32)return;
keys=[];
names=[];
counts=[];
integer i;
for(i=2;i<=total;++i)
{
keys += [llGetLinkKey(i)];
names += [llGetLinkName(i)];
counts += [0];
}
active=TRUE;
llSetTimerEvent(1.0);
llOwnerSay("Measurement session started.");
}
timer()
{
if(!active)return;
++samples;
if(llGetObjectPrimCount(llGetKey())!=total)
{
llOwnerSay("Prim count changed; stopped.");
finish();
return;
}
integer i;
for(i=2;i<=total;++i)
{
integer at=i-2;
if(llGetLinkKey(i)!=llList2Key(keys,at))
{
llOwnerSay("Link identity changed; stopped.");
finish();
return;
}
string name=llGetLinkName(i);
if(name!=llList2String(names,at))
{
counts=llListReplaceList(counts,[llList2Integer(counts,at)+1],at,at);
names=llListReplaceList(names,[name],at,at);
}
}
if(samples>=30)finish();
}
changed(integer flags)
{
if(flags&CHANGED_OWNER)llResetScript();
}
}
MIT · original Incoprea example
API reference 1 · API reference 2 · API reference 3 · API reference 4 · API reference 5 · API reference 6 · API reference 7
Building helpers · IntermediateWorld-grid alignment preview
Snap root horizontal position to half-meter region grid while preserving height.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Use unattached nonphysical root away from region edges. Owner-touch previews/restores.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Region rules can clamp movement; failures are reported. Does not change rotation or link offsets.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
vector home;
default
{
state_entry()
{
home=llGetRootPosition();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetLinkNumber()>1||llGetAttached()||llGetStatus(STATUS_PHYSICS))return;
preview=!preview;
if(preview)
{
vector target=home;
target.x=llRound(home.x*2.0)*0.5;
target.y=llRound(home.y*2.0)*0.5;
if(!llSetRegionPos(target))llOwnerSay("Move failed; inspect for clamping.");
}
else
{
if(!llSetRegionPos(home))llOwnerSay("Restore failed; inspect for clamping.");
}
}
}
MIT · original Incoprea example
API reference 1
Building helpers · IntermediateWorld-upright child preview
Make a child world-upright while preserving horizontal forward bearing.
LSL · Second Life / OpenSim candidate
Not compiled or tested in-world
Code & how to use
Setup: Put in nonphysical child; owner-touch previews/restores. Keep root still.
Stop / restore: Owner-touch again to restore the startup snapshot before removal or reset, unless setup describes a different cycle. Do not relink during a preview.
Use a spare modifiable build. Saved state lives only in script memory. Converts world orientation into root-local rotation.
// Original Incoprea. MIT. Not compiled or tested in-world.
integer preview;
rotation home;
default
{
state_entry()
{
home=llGetLocalRot();
}
touch_start(integer n)
{
if(llDetectedKey(0)!=llGetOwner())return;
if(llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS))return;
vector forward=llRot2Fwd(home*llGetRootRotation());
forward.z=0.0;
if(llVecMag(forward)<0.01)return;
preview=!preview;
if(preview)
{
rotation root=llGetRootRotation();
vector f=llRot2Fwd(home*root);
float yaw=llAtan2(f.y,f.x);
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,llEuler2Rot(<0.0,0.0,yaw>)/root]);
}
else
{
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,home]);
}
}
}
MIT · original Incoprea example
API reference 1 · API reference 2