// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Read a filename extension // Not compiled or tested in-world // Setup: Edit FILENAME and touch as owner. // Stop / restore: Remove or disable the script. It does not change the build. // Notes: Accepts a filename, not a complete URL or path. A leading dot alone is treated as a hidden filename, not an extension. An extension does not prove the file’s actual format. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. string FILENAME = "garden.preview.PNG"; default { touch_start(integer count) { if (llDetectedKey(0) != llGetOwner()) return; integer dot = -1; integer i; for (i = 1; i < llStringLength(FILENAME); ++i) if (llGetSubString(FILENAME, i, i) == ".") dot = i; if (dot == -1 || dot == llStringLength(FILENAME) - 1) llOwnerSay("No extension found."); else llOwnerSay("Extension: " + llToLower(llGetSubString(FILENAME, dot + 1, -1))); } changed(integer flags) { if (flags & CHANGED_OWNER) llResetScript(); } }