// ===================================================================== // Link Numbers // skimi3d script library // https://grid.skimi3d.com/scripts/link-numbers // // Writes each prim's link number over its head, so you can see the // order of a linkset instead of guessing at it. // // You need this the moment a script starts addressing prims by number. // A destination board that lights panels 1, 2 and 3 along the front and // 4, 5 and 6 along the back is unarguable when you can see the numbers, // and a morning of quiet nonsense when you cannot. // // Put it in, look, take it out. It is a tool, not a fitting. // // Plain LSL. // ===================================================================== // --------------------------------------------------------------------- // Settings // --------------------------------------------------------------------- // The root prim is always link number 1, and it is worth being able to // pick it out at a glance, so it gets its own colour. vector ROOT_COLOUR = <0.35, 1.00, 0.45>; vector OTHER_COLOUR = <1.00, 0.85, 0.20>; // --------------------------------------------------------------------- // Everything below here is the machinery // --------------------------------------------------------------------- integer gShowing = TRUE; show(integer on) { integer n = llGetNumberOfPrims(); integer i; for (i = 1; i <= n; ++i) { if (on) { vector colour = OTHER_COLOUR; if (i == 1) colour = ROOT_COLOUR; llSetLinkPrimitiveParamsFast(i, [PRIM_TEXT, (string)i, colour, 1.0]); } else { llSetLinkPrimitiveParamsFast(i, [PRIM_TEXT, "", ZERO_VECTOR, 0.0]); } } } default { state_entry() { show(TRUE); // The warning matters more than it looks. Hover text belongs to // the prim, not to the script, so taking the script out while // the numbers are showing leaves them showing for ever, and // there is no event that lets a script tidy up after itself as // it is removed. Touch first, take out second. llOwnerSay("Link numbers on. The root is 1, in green. Touch to turn them off, and turn them off BEFORE you take this script out, or the numbers stay."); } touch_start(integer total) { gShowing = !gShowing; show(gShowing); } changed(integer what) { // Re-linking renumbers everything, which is exactly the moment // you want to look again. if (what & CHANGED_LINK) show(gShowing); } }