// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Burst-friendly request budget // Not compiled or tested in-world // Setup: Put in a spare prim you own. Touch to spend a token; wait to refill. Capacity and refill rate are editable constants. // 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: Uses elapsed time instead of a repeating timer. This is a local usage budget, not an authorization or monetary system. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. float CAPACITY = 3.0; float REFILL_PER_SECOND = 0.5; float tokens = 3.0; float lastCheck; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; float now = llGetTime(); tokens += (now-lastCheck)*REFILL_PER_SECOND; lastCheck = now; if (tokens > CAPACITY) tokens = CAPACITY; if (tokens < 1.0) { llOwnerSay("Budget empty; let it refill."); return; } tokens -= 1.0; llOwnerSay("Accepted; tokens left: " + (string)tokens); } changed(integer change) { if (change & CHANGED_OWNER) llResetScript(); } }