// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Decode character-counted string records // Not compiled or tested in-world // Setup: Edit the small sample lists and touch as owner. These examples print previews only. // Stop / restore: Remove or disable; no simulator objects or persistent records are changed. // Notes: Accepts at most 20 records and 800 input characters. An incomplete prefix or value rejects the entire decoded preview. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. string INPUT="10:Lamp:green0:10:Bench|wide"; default { touch_start(integer touches) { if(llDetectedKey(0)!=llGetOwner())return; if(llStringLength(INPUT)>800) { llOwnerSay("Input too long."); return; } integer pos; integer total=llStringLength(INPUT); list result; while(pos=20) { llOwnerSay("Too many records."); return; } string tail=llGetSubString(INPUT,pos,-1); integer colon=llSubStringIndex(tail,":"); if(colon<1 || colon>3) { llOwnerSay("Invalid length prefix."); return; } string digits=llGetSubString(tail,0,colon-1); integer i; for(i=0;itotal) { llOwnerSay("Truncated value."); return; } string value=""; if(length>0)value=llGetSubString(INPUT,pos,pos+length-1); result += [value]; pos+=length; } llOwnerSay("Decoded: "+llList2CSV(result)); } changed(integer flags) { if(flags & CHANGED_OWNER)llResetScript(); } }