// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Analog minute hand // Not compiled or tested in-world // Setup: Use a hinge-centered clock hand with +X pointing to the right at startup. Root-local clock face should be in XY; put the script in the child. // Stop / restore: Owner-touch to stop and restore the captured starting pose before removing, resetting, or relinking. // Notes: Use a small nonphysical rezzed build with clear space. Actual prim transforms change. Original poses live only in script memory. Do not change physical status or link topology during use. The hand points to +Y at minute zero and rotates clockwise. It sets the actual angle, not an accumulating timer approximation. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. vector home; rotation rest; integer active; integer valid=TRUE; default { state_entry() { home=llGetLocalPos(); rest=llGetLocalRot(); } touch_start(integer count) { if(llDetectedKey(0)!=llGetOwner()||!valid||llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS))return; active=!active; if(active) { llResetTime(); string stamp=llGetTimestamp(); integer minute=(integer)llGetSubString(stamp,14,15); integer second=(integer)llGetSubString(stamp,17,18); float angle=PI_BY_TWO-TWO_PI*(minute+second/60.0)/60.0; llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,llEuler2Rot(<0.0,0.0,angle>)]); llSetTimerEvent(1); } else { llSetTimerEvent(0.0); llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POS_LOCAL,home,PRIM_ROT_LOCAL,rest]); } } timer() { if(llGetLinkNumber()<2||llGetStatus(STATUS_PHYSICS)) { llSetTimerEvent(0.0); active=FALSE; return; } string stamp=llGetTimestamp(); integer minute=(integer)llGetSubString(stamp,14,15); integer second=(integer)llGetSubString(stamp,17,18); float angle=PI_BY_TWO-TWO_PI*(minute+second/60.0)/60.0; llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,llEuler2Rot(<0.0,0.0,angle>)]); } changed(integer change) { if(change&CHANGED_LINK) { valid=FALSE; active=FALSE; llSetTimerEvent(0.0); llOwnerSay("Links changed; stopped without restoring. Reposition and reset before reuse."); } } }