// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Private material quantity ledger // Not compiled or tested in-world // Setup: Place in your own object and touch. Enter material|quantity, list, or clear. Up to 12 material names. // Stop / restore: Remove or reset to erase session data. Input listeners close after one reply or after 45 seconds. // Notes: Data lives only in script memory and is lost on reset. No visitors are logged and no external requests are sent. Quantities are plans, not simulator inventory amounts. Names are exact and case-sensitive; later entries replace an earlier quantity. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. list names; list quantities; integer positive(string input) { if(input=="" || llStringLength(input)>5)return FALSE; integer i; for(i=0;i0; } integer handle; integer channel; closeInput() { if(handle)llListenRemove(handle); handle=0; llSetTimerEvent(0); } respond(string input) { input=llStringTrim(input,STRING_TRIM); if(llStringLength(input)>200) { llOwnerSay("Use at most 200 characters."); return; } if(input=="clear") { names=[]; quantities=[]; llOwnerSay("Plan cleared."); return; } if(input=="list") { integer i; for(i=0;i=12) { llOwnerSay("Ledger full."); return; } names += [name]; quantities += [llList2Integer(p,1)]; } else quantities=llListReplaceList(quantities,[llList2Integer(p,1)],index,index); llOwnerSay("Quantity recorded."); } default { touch_start(integer touches) { if(llDetectedKey(0)!=llGetOwner())return; closeInput(); channel=-10000-(integer)llFrand(1000000000); handle=llListen(channel,"",llGetOwner(),""); llSetTimerEvent(45); llTextBox(llGetOwner(),"Enter material|quantity, list, or clear. Up to 12 material names.",channel); } listen(integer c,string name,key speaker,string input) { if(c!=channel || speaker!=llGetOwner())return; closeInput(); respond(input); } timer() { closeInput(); llOwnerSay("Input closed."); } changed(integer flags) { if(flags & CHANGED_OWNER)llResetScript(); } }