// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Weighted blend of numeric samples // Not compiled or tested in-world // Setup: Put in a spare prim you own. Edit alternating value/weight pairs in DATA. Touch to calculate the weighted mean. // Stop / restore: Disable or remove the script. It only reports to its owner and does not change prim properties. Reset clears its temporary state. // Notes: Weights describe relative influence, not percentages; their sum need not be one. Negative weights are deliberately rejected. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. list DATA=[10.0,1.0,20.0,3.0,40.0,2.0]; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; integer n=llGetListLength(DATA); if (n==0 || n%2) { llOwnerSay("Use value/weight pairs."); return; } float sum=0.0; float weightSum=0.0; integer i; for (i=0; i