// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Two-flea tabletop race // Not compiled or tested in-world // Setup: Enter roll. A and B alternate; first to reach20 wins. Owner-touch initializes; enter reset to restart. Text input closes after90seconds. // Stop / restore: Close or ignore the text box, or remove the script. It changes no world objects, avatar state or inventory. // Notes: Original bounded, manually stepped educational toy. Not a calibrated simulator, real-world control system, or live scientific measurement. A single owner operates both fictional racers. It is not network multiplayer or a betting system. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer channel; integer handle; integer a; integer b; integer turn; integer done; close() { if(handle)llListenRemove(handle); handle=0; llSetTimerEvent(0.0); } start() { a=0; b=0; turn=0; done=FALSE; } string view() { return "A "+(string)a+"/20 | B "+(string)b+"/20 | next "+llList2String(["A","B"],turn); } show() { llOwnerSay(view()); if(!handle) { channel=-1000-(integer)llFrand(1000000.0); handle=llListen(channel,"",llGetOwner(),""); } llTextBox(llGetOwner(),"Enter roll. A and B alternate; first to reach20 wins. 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 s) { if(!handle||incomingChannel!=channel||id!=llGetOwner())return; s=llToLower(llStringTrim(s,STRING_TRIM)); if(s=="reset")start(); else { if(s=="roll"&&!done) { integer die=1+(integer)llFrand(6.0); llOwnerSay("Rolled "+(string)die); if(turn)b+=die; else a+=die; if(a>=20||b>=20) { done=TRUE; llOwnerSay(llList2String(["A","B"],turn)+" wins."); } else turn=!turn; } } show(); } timer() { close(); } }