// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Linked prim distance ruler // Not compiled or tested in-world // Setup: Put in the root of a rezzed linked build. Child prims must pass touches to the root, usually by having no touch-handling script. Owner-touch one prim, then another. // Stop / restore: Remove or disable. No object settings are changed. // Notes: Measures prim center positions, not touched surface points or mesh bounds. Move or relink only between completed measurement pairs. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Not compiled or tested in-world. integer pending; integer firstLink; vector first; default { touch_start(integer count) { if (llDetectedKey(0) != llGetOwner() || llGetLinkNumber() > 1) return; integer link = llDetectedLinkNumber(0); vector position = llList2Vector(llGetLinkPrimitiveParams(link, [PRIM_POSITION]), 0); if (!pending) { pending = TRUE; first = position; firstLink = link; llOwnerSay("First prim selected. Touch the second prim."); } else { pending = FALSE; llOwnerSay("Center distance " + (string)firstLink + " to " + (string)link + ": " + (string)llVecDist(first, position) + " meters."); } } changed(integer change) { if (change & CHANGED_LINK) pending = FALSE; } }