User:Talia Tokugawa/scripts/DialogMenu
Jump to navigation
Jump to search
This is just an example dialog menu setup specifically for the owner of the item. Features "remenu", extending time out, random high channel listeners.
key owner; integer listenChan; integer listener; integer count; menu() { listenChan=(integer)llFrand(899999) + 100000; listener=llListen(listenChan, "", owner, ""); llDialog(owner, "Please select an option:", ["Option A", "Option B", "Done"], listenChan); count=10; llSetTimerEvent(3.0); } default { listen(integer ich, string sna, key kid, string sme) { llListenRemove(listener); if (ich==listenChan&&kid==owner) { //do stuff with option replies if (sme=="Done") return; else { if (sme=="Option A") //Do something here else if (sme=="Option B") //Do something else here menu(); } } } timer() { --count; if (count==0) { llListenRemove(listener); llSetTimerEvent(0.0); } } state_entry() { llWhisper(0, "/me are online."); owner=llGetOwner(); menu(); } on_rez(integer isp) { if (owner!=llGetOwner()) llResetScript(); } touch_start(integer itn) { if (llDetectedKey(0)==owner) menu(); } }