// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Notecard question and answer reveal // Not compiled or tested in-world // Setup: Add quiz with one question|answer pair per line. Owner-touch alternates question and answer, then advances. // Stop / restore: Remove/disable; only owner chat is used. // Notes: Pairs are authored content. Malformed lines are reported and advanced one per touch; no unbounded skip loop is used. Keep example captions and notecard lines short, preferably ASCII. Character clipping is not UTF-8 byte-budget clipping: multibyte text may reach hover-text or chat limits sooner and be truncated. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer line; integer reveal; string answer; key request; default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner()||request!=NULL_KEY)return; if(reveal) { llOwnerSay("Answer: "+answer); reveal=FALSE; return; } if(llGetInventoryType("quiz")!=INVENTORY_NOTECARD)return; request=llGetNotecardLine("quiz",line); llSetTimerEvent(15.0); } dataserver(key id,string data) { if(id!=request)return; request=NULL_KEY; llSetTimerEvent(0.0); if(data==EOF) { line=0; llOwnerSay("Quiz complete; next touch starts again."); return; } ++line; list pair=llParseStringKeepNulls(data,["|"],[]); if(llGetListLength(pair)!=2) { llOwnerSay("Expected question|answer on line "+(string)line); return; } answer=llGetSubString(llList2String(pair,1),0,800); reveal=TRUE; llOwnerSay("Question: "+llGetSubString(llList2String(pair,0),0,800)+" (touch to reveal)"); } timer() { request=NULL_KEY; llSetTimerEvent(0.0); } changed(integer change) { if(change&CHANGED_INVENTORY) { request=NULL_KEY; line=0; reveal=FALSE; llSetTimerEvent(0.0); } } }