// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Browse a notecard glossary by prefix // Not compiled or tested in-world // Setup: Create a saved plain-text notecard named Data. Use term|definition rows. Set PREFIX to a nonempty string. Touch as owner to load it; touch again to use the cached content. // Stop / restore: Remove or disable. Reset or an inventory change discards the cache. No notecards are changed. // Notes: At most 60 lines, 300 characters per line, and 6000 total characters; blank lines and # comments are omitted. Incomplete reads are rejected. Case-insensitive prefix search; emits at most ten matches and tells you how many matched in total. Definitions remain authored text, not verified facts. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. string PREFIX="rot"; list lines; integer lineNumber; integer characters; integer loaded; key pending=NULL_KEY; request() { pending=llGetNotecardLine("Data",lineNumber); llSetTimerEvent(20); } run() { string prefix=llToLower(PREFIX); if(prefix=="") { llOwnerSay("Set a nonempty prefix."); return; } integer i; integer matches; for(i=0;i=60 || llStringLength(data)>300 || characters>6000) { pending=NULL_KEY; llSetTimerEvent(0); lines=[]; llOwnerSay("Read rejected: card exceeds bounds."); return; } data=llStringTrim(data,STRING_TRIM); if(data!="" && llGetSubString(data,0,0)!="#")lines += [data]; ++lineNumber; request(); } timer() { pending=NULL_KEY; lines=[]; llSetTimerEvent(0); llOwnerSay("Read timed out; touch to retry."); } changed(integer flags) { if(flags & (CHANGED_OWNER|CHANGED_INVENTORY))llResetScript(); } }