// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Bridge and torch puzzle // Not compiled or tested in-world // Setup: Enter a or ab etc. Travel times a=1,b=2,c=5,d=10. One or two on torch side move. Owner-touch starts a fresh game; type reset to restart. Input times out after 90 seconds. // Stop / restore: Let the input timeout expire or remove the script. No world geometry, avatar or inventory is changed. // Notes: Original compact educational game. Owner-only local input; no scores or avatar identities are sent to a service. Output is short ASCII text. Not a competition authority. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer channel; integer handle; list banks; integer torch; integer elapsed; close() { if(handle)llListenRemove(handle); handle=0; llSetTimerEvent(0.0); } start() { banks=[0,0,0,0]; torch=0; elapsed=0; } string board() { return "Far banks a,b,c,d: "+llList2CSV(banks)+" | torch "+(string)torch+" | minutes "+(string)elapsed; } show() { llOwnerSay(board()); if(!handle) { channel=-1000-(integer)llFrand(1000000.0); handle=llListen(channel,"",llGetOwner(),""); } llTextBox(llGetOwner(),"Enter a or ab etc. Travel times a=1,b=2,c=5,d=10. One or two on torch side move. Type reset to restart.",channel); llSetTimerEvent(90.0); } default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; close(); start(); show(); } listen(integer incomingChannel,string name,key id,string input) { if(!handle||incomingChannel!=channel||id!=llGetOwner())return; input=llToLower(llStringTrim(input,STRING_TRIM)); if(input=="reset")start(); else { integer len=llStringLength(input); if(len>=1&&len<=2) { integer a=llSubStringIndex("abcd",llGetSubString(input,0,0)); integer b=a; if(len==2)b=llSubStringIndex("abcd",llGetSubString(input,1,1)); if(a>=0&&b>=0&&(len==1||a!=b)&&llList2Integer(banks,a)==torch&&llList2Integer(banks,b)==torch) { list times=[1,2,5,10]; integer cost=llList2Integer(times,a); if(llList2Integer(times,b)>cost)cost=llList2Integer(times,b); torch=1-torch; banks=llListReplaceList(banks,[torch],a,a); banks=llListReplaceList(banks,[torch],b,b); elapsed+=cost; if(llList2CSV(banks)=="1, 1, 1, 1")llOwnerSay("All crossed in "+(string)elapsed+" minutes."); } else llOwnerSay("Traveler unavailable or repeated."); } } show(); } timer() { close(); } }