// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Reaction-time toy // Not compiled or tested in-world // Setup: Put in a spare prim. Owner-touch starts. Wait for green GO; touching early cancels the round. // Stop / restore: After a result, remove the script and clear its hover text. A round also times out after ten seconds at GO. // Notes: Network, viewer, and script lag contribute to the result; this is a toy, not a reliable human reaction-time measurement. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Not compiled or tested in-world. integer phase; default { touch_start(integer count) { if (llDetectedKey(0) != llGetOwner()) return; if (!phase) { phase = 1; llSetText("Wait...", <1.0, 0.7, 0.2>, 1.0); llSetTimerEvent(2.0 + llFrand(3.0)); } else if (phase == 1) { phase = 0; llSetTimerEvent(0.0); llSetText("Too soon. Touch to retry.", <1.0, 0.5, 0.5>, 1.0); } else { phase = 0; llSetTimerEvent(0.0); llSetText((string)llGetTime() + " seconds (includes lag)\nTouch to retry", <0.7, 1.0, 0.8>, 1.0); } } timer() { if (phase == 1) { phase = 2; llResetTime(); llSetText("GO!", <0.4, 1.0, 0.4>, 1.0); llSetTimerEvent(10.0); } else { phase = 0; llSetTimerEvent(0.0); llSetText("Round expired. Touch to retry.", <0.8, 0.8, 0.8>, 1.0); } } }