Difference between revisions of "User:Talia Tokugawa/scripts/DialogMenu"
Jump to navigation
Jump to search
(New page: This is just an example dialog menu setup specifically for the owner of the item. Features "remenu", extending time out, random high channel listeners. <lsl> key owner; integer listenChan...) |
|||
Line 2: | Line 2: | ||
Features "remenu", extending time out, random high channel listeners. | Features "remenu", extending time out, random high channel listeners. | ||
key owner; | |||
key owner; | integer listenChan; | ||
integer listenChan; | integer listener; | ||
integer listener; | integer count; | ||
integer count; | menu() { | ||
menu() | |||
{ | |||
listenChan=(integer)llFrand(899999) + 100000; | listenChan=(integer)llFrand(899999) + 100000; | ||
listener=llListen(listenChan, "", owner, ""); | listener=llListen(listenChan, "", owner, ""); | ||
Line 14: | Line 12: | ||
count=10; | count=10; | ||
llSetTimerEvent(3.0); | llSetTimerEvent(3.0); | ||
} | |||
} | default { | ||
listen(integer ich, string sna, key kid, string sme) { | |||
default | |||
{ | |||
listen(integer | |||
llListenRemove(listener); | llListenRemove(listener); | ||
if ( | if (ich==listenChan&&kid==owner) { | ||
//do stuff with option replies | //do stuff with option replies | ||
if ( | if (sme=="Done") return; | ||
else | else { | ||
if (sme=="Option A") //Do something here | |||
if ( | else if (sme=="Option B") //Do something else here | ||
else if ( | |||
menu(); | menu(); | ||
} | } | ||
Line 35: | Line 27: | ||
} | } | ||
timer() | timer() { | ||
--count; | --count; | ||
if (count==0) | if (count==0) { | ||
llListenRemove(listener); | llListenRemove(listener); | ||
llSetTimerEvent(0.0); | llSetTimerEvent(0.0); | ||
Line 45: | Line 35: | ||
} | } | ||
state_entry() | state_entry() { | ||
llWhisper(0, "/me are online."); | llWhisper(0, "/me are online."); | ||
owner=llGetOwner(); | owner=llGetOwner(); | ||
Line 52: | Line 41: | ||
} | } | ||
on_rez(integer | on_rez(integer isp) { | ||
if (owner!=llGetOwner()) llResetScript(); | if (owner!=llGetOwner()) llResetScript(); | ||
} | } | ||
touch_start(integer | touch_start(integer itn) { | ||
if (llDetectedKey(0)==owner) menu(); | if (llDetectedKey(0)==owner) menu(); | ||
} | } | ||
} | |||
} | |||
Revision as of 13:47, 23 August 2023
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(); } }