// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // A threshold that does not chatter // Not compiled or tested in-world // Setup: Put in a spare prim you own. Touch through the predefined sample levels and watch the state transitions. // 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: No sensor or scene effect is used. The separate on/off thresholds prevent rapid toggling around a single boundary. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. list SAMPLES = [0.2,0.65,0.72,0.68,0.5,0.32,0.28,0.35]; integer cursor; integer active; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; float value = llList2Float(SAMPLES,cursor); cursor = (cursor+1)%llGetListLength(SAMPLES); integer previous = active; if (!active && value >= 0.7) active = TRUE; else if (active && value <= 0.3) active = FALSE; string change = "held"; if (active != previous) change = "changed"; llOwnerSay("Value="+(string)value+"; active="+(string)active+" ("+change+")"); } changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); } }