// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Small bounded work queue // Not compiled or tested in-world // Setup: Put in a spare prim you own. Touch to enqueue numbered demonstration jobs; one job completes per second. // Stop / restore: Disable or remove the script. It only reports to its owner and does not change prim properties. Reset clears its temporary state. // Notes: Rejects new work when full instead of growing without bound. Jobs are only owner-chat messages; reset discards pending work. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. list queue; integer sequence; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; if (llGetListLength(queue) >= 5) { llOwnerSay("Queue full; try later."); return; } ++sequence; queue += [sequence]; llSetTimerEvent(1.0); llOwnerSay("Queued job " + (string)sequence); } changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); } timer() { if (llGetListLength(queue) == 0) { llSetTimerEvent(0.0); return; } integer job = llList2Integer(queue,0); queue = llDeleteSubList(queue,0,0); llOwnerSay("Completed job " + (string)job); if (llGetListLength(queue) == 0) llSetTimerEvent(0.0); } }