// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Three-choice touch menu // Not compiled or tested in-world // Setup: Touch the object. Choices arrive through the viewer dialog; a short-lived, per-avatar listener captures the reply. // Stop / restore: The listener times out after 30 seconds or closes after one answer. // Notes: Menus appear only for the toucher. Replies are matched to their avatar key. Works best with a viewer that accepts llDialog. // License: see LICENSE in this distribution. // Original Incoprea example. Dialog is private to the touching avatar. integer listenHandle; integer replyChannel; key toucher; default { state_entry() { llSetTimerEvent(0.0); } touch_start(integer count) { if (listenHandle) llListenRemove(listenHandle); toucher = llDetectedKey(0); replyChannel = -1000 - (integer)llFrand(1000000.0); listenHandle = llListen(replyChannel, "", toucher, ""); llDialog(toucher, "Choose a tiny adventure:", ["Moon", "Garden", "Return"], replyChannel); llSetTimerEvent(30.0); } listen(integer channel, string name, key id, string choice) { if (id == toucher) { llInstantMessage(toucher, "You chose: " + choice); llListenRemove(listenHandle); listenHandle = 0; llSetTimerEvent(0.0); } } timer() { if (listenHandle) llListenRemove(listenHandle); listenHandle = 0; llSetTimerEvent(0.0); } }