// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Lamp radius and intensity menu // Not compiled or tested in-world // Setup: Use a spare lamp and owner-touch. Enable/Disable affect the point light; Restore reinstates its startup parameters. // Stop / restore: Use the Restore or Home action described in setup before removing or resetting if you want the startup appearance. Menu listeners expire after 45 seconds. // Notes: Local owner-only control. Saved snapshots live in script memory and are lost on reset. Light color and falloff are preserved. Radius is capped at 10 meters and intensity at 0.7 for a modest exhibit light. // 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); } menu(string prompt,list buttons) { if(!handle) { channel=-1000-(integer)llFrand(1000000.0); handle=llListen(channel,"",llGetOwner(),""); } llDialog(llGetOwner(),prompt,buttons,channel); llSetTimerEvent(45.0); } list saved; list current; init() { saved=llGetLinkPrimitiveParams(LINK_THIS,[PRIM_POINT_LIGHT]); current=saved; } show() { menu("Point light controls",["Enable","Disable","Brighter","Dimmer","Wider","Narrower","Restore"]); } choose(string s) { if(s=="Restore")current=saved; else { integer enabled=llList2Integer(current,0); float strength=llList2Float(current,2); float radius=llList2Float(current,3); if(s=="Enable")enabled=TRUE; else if(s=="Disable")enabled=FALSE; else if(s=="Brighter")strength+=0.1; else if(s=="Dimmer")strength-=0.1; else if(s=="Wider")radius+=0.5; else if(s=="Narrower")radius-=0.5; else return; if(strength<0.0)strength=0.0; if(strength>0.7)strength=0.7; if(radius<0.1)radius=0.1; if(radius>10.0)radius=10.0; current=[enabled,llList2Vector(current,1),strength,radius,llList2Float(current,4)]; } llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POINT_LIGHT]+current); show(); } default { state_entry() { init(); } touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; close(); show(); } listen(integer ch,string name,key id,string message) { if(!handle||ch!=channel||id!=llGetOwner())return; choose(message); } timer() { close(); } changed(integer change) { if(change&CHANGED_OWNER)llResetScript(); } }