// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Preview a bounded JSON numeric update // Not compiled or tested in-world // Setup: Edit DOCUMENT and the example settings, then touch as owner. Requires simulator support for LSL JSON functions. // Stop / restore: Remove or disable. JSON changes occur only in a local preview string. // Notes: Changes a preview string only. Requires the existing field already be numeric, so a schema mismatch is not silently repaired. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. string DOCUMENT="{\"intensity\":0.2,\"title\":\"Lamp\"}"; string FIELD="intensity"; float VALUE=0.6; default { touch_start(integer touches) { if(llDetectedKey(0)!=llGetOwner())return; if(llJsonValueType(DOCUMENT,[FIELD])!=JSON_NUMBER) { llOwnerSay("Existing field is not numeric."); return; } if(VALUE<0 || VALUE>1) { llOwnerSay("New value must be 0-1."); return; } llOwnerSay(llJsonSetValue(DOCUMENT,[FIELD],(string)VALUE)); } changed(integer flags) { if(flags & CHANGED_OWNER)llResetScript(); } }