// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Compare sequence numbers across wrap // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set CURRENT and CANDIDATE from0 to65535. Owner touch runs the local demonstration. // Stop / restore: Disable/remove. No external requests or scene changes occur; reset clears memory. // Notes: A distance of exactly32768 is ambiguous. The method assumes updates never get more than half the sequence space apart. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Local owner-only protocol laboratory. integer CURRENT=65532; integer CANDIDATE=3; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(CURRENT<0||CURRENT>65535||CANDIDATE<0||CANDIDATE>65535) { llOwnerSay("Use16-bit sequence numbers."); return; } integer delta=(CANDIDATE-CURRENT)&65535; string result="older"; if(delta==0)result="same"; else if(delta==32768)result="ambiguous half-range"; else if(delta<32768)result="newer"; llOwnerSay("Candidate is "+result+"; modular distance="+(string)delta); } }