// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Morse letter decoder // Not compiled or tested in-world // Setup: Owner-touch and enter one group such as .- or --.. // Stop / restore: Stop responding and the listener closes after 90 seconds, or remove/disable the script. Owner-touch restarts the exercise. // Notes: Owner-only local exercise; no prizes, visitor records, network service, or persistent scores. A–Z lookup only; punctuation, procedural signals and numbers are intentionally excluded. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer channel; integer handle; close() { if(handle)llListenRemove(handle); handle=0; llSetTimerEvent(0.0); } ask(string prompt) { if(!handle) { channel=-1000-(integer)llFrand(1000000.0); handle=llListen(channel,"",llGetOwner(),""); } llTextBox(llGetOwner(),prompt,channel); llSetTimerEvent(90.0); } list codes=[".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]; start() { ask("Enter one Morse letter using . and - (for example .-)."); } answer(string s) { integer p=llListFindList(codes,[s]); if(p<0) { ask("Not an A-Z Morse letter. Try one group without spaces."); return; } close(); llOwnerSay(s+" = "+llGetSubString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",p,p)); } default { touch_start(integer count) { if(llDetectedKey(0)!=llGetOwner())return; close(); start(); } listen(integer ch,string name,key id,string message) { if(!handle||ch!=channel||id!=llGetOwner())return; answer(llStringTrim(message,STRING_TRIM)); } timer() { close(); llOwnerSay("Exercise paused. Touch to restart."); } changed(integer change) { if(change&CHANGED_OWNER)llResetScript(); } }