// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Locate a frame inside an atlas // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set COLUMNS, ROWS and zero-based FRAME. Touch for owner-only output. // Stop / restore: Remove/disable. The script calculates only; no scene properties change. // Notes: Row zero starts at the top of the image; V coordinates are reported bottom-up. Texture animation APIs may use their own order. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Planning only. integer COLUMNS=4; integer ROWS=3; integer FRAME=6; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(COLUMNS<1||ROWS<1||COLUMNS>64||ROWS>64||FRAME<0||FRAME>=COLUMNS*ROWS) { llOwnerSay("Invalid atlas dimensions/frame."); return; } integer column=FRAME%COLUMNS; integer row=FRAME/COLUMNS; float left=(float)column/(float)COLUMNS; float right=(float)(column+1)/(float)COLUMNS; float top=1.0-(float)row/(float)ROWS; float bottom=1.0-(float)(row+1)/(float)ROWS; llOwnerSay("Column="+(string)column+" row="+(string)row+" bounds U="+(string)left+".."+(string)right+" V="+(string)bottom+".."+(string)top); } }