Difference between revisions of "User:Talia Tokugawa/scripts/DialogMenu"

From Second Life Wiki
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.


<lsl>
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 c, string n, key id, string m)
    {
         llListenRemove(listener);
         llListenRemove(listener);
         if (c==listenChan&&id==owner)
         if (ich==listenChan&&kid==owner) {
        {
             //do stuff with option replies     
             //do stuff with option replies     
             if (m=="Done") return;
             if (sme=="Done") return;
             else
             else {
            {
                 if (sme=="Option A") //Do something here  
                 if (m=="Option A") //Do something here  
                 else if (sme=="Option B") //Do something else here
                 else if (m=="Option B") //Do something else here
                 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 p)
     on_rez(integer isp) {
    {
         if (owner!=llGetOwner()) llResetScript();         
         if (owner!=llGetOwner()) llResetScript();         
     }
     }


     touch_start(integer total_number)
     touch_start(integer itn) {
    {
         if (llDetectedKey(0)==owner) menu();
         if (llDetectedKey(0)==owner) menu();
     }
     }
 
}
 
}
</lsl>

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();
   }
}