// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Chess-square color trainer // Not compiled or tested in-world // Setup: Owner-touch. Answer LIGHT or DARK for a random square such as c5. // 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. Uses the standard convention that a1 is dark. It teaches the board pattern, not chess moves or rules. // 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); } integer file; integer rank; string square; start() { file=(integer)llFrand(8.0); rank=1+(integer)llFrand(8.0); square=llGetSubString("abcdefgh",file,file)+(string)rank; ask("Is "+square+" LIGHT or DARK? a1 is dark."); } answer(string s) { s=llToLower(s); if(s!="light"&&s!="dark") { ask("Enter LIGHT or DARK."); return; } string correct="dark"; if((file+rank)%2==0)correct="light"; close(); if(s==correct)llOwnerSay("Correct: "+square+" is "+correct); else llOwnerSay(square+" is "+correct); } 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(); } }