// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Find a whole ASCII word // Not compiled or tested in-world // Setup: Edit TEXT and WORD; touch as owner. // Stop / restore: Remove or disable; results are reported only to the owner. // Notes: Case-insensitive ASCII word-boundary rule; punctuation separates words. This is not a general Unicode linguistic tokenizer. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. string TEXT="A lamp, lampshade, and LAMP."; string WORD="lamp"; default { touch_start(integer touches) { if(llDetectedKey(0)!=llGetOwner())return; string text=llToLower(TEXT); string word=llToLower(WORD); if(word=="") { llOwnerSay("Set a word."); return; } integer found; integer i; for(i=0;i<=llStringLength(text)-llStringLength(word);++i) { if(llGetSubString(text,i,i+llStringLength(word)-1)==word) { integer left=TRUE; integer right=TRUE; if(i>0)left=llSubStringIndex("abcdefghijklmnopqrstuvwxyz0123456789_",llGetSubString(text,i-1,i-1))==-1; integer after=i+llStringLength(word); if(after