Difference between revisions of "LlListenControl"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Minor formatting changes and comments)
Line 20: Line 20:
     state_entry()
     state_entry()
     {
     {
      handle = llListen(5,"", NULL_KEY, "");
        handle = llListen(5, "", NULL_KEY, "");   // Establish a listener to listen to anything on channel 5 ...
      llListenControl(handle, FALSE);
        llListenControl(handle, FALSE);           // ... but make the listener inactive for now
      llSetText("not listening", <0.0,0.0,0.0>,1.0);
        llSetText("not listening", <0.0,0.0,0.0>, 1.0);
     }
     }


     touch_start(integer total_number)
     touch_start(integer total_number)
     {
     {
         toggle=!toggle;
         toggle = !toggle;
        llListenControl(handle, toggle);
        llListenControl(handle, toggle);           // Make the listener active or inactive as required
         if(toggle){
 
             llSay(0,"now listening on channel 5");
         if(toggle)
             llSetText("listening on ch 5", <1.0,0.0,0.0>,1.0);
        {
        }
             llSay(0, "now listening on channel 5");
        else{
             llSetText("listening on ch 5", <1.0,0.0,0.0>, 1.0);
            llSay(0,"not listening any more");
            llSetText("not listening", <0.0,0.0,0.0>,1.0);
         }
         }
     
        else
        {
            llSay(0, "not listening any more");
            llSetText("not listening", <0.0,0.0,0.0>, 1.0);
        }   
     }
     }
      
      
     listen(integer channel, string name, key id, string message)
     listen(integer channel, string name, key id, string message)
     {
     {
         llSay(0, name+" just said "+message);
         llSay(0, name + " just said " + message);
     }
     }
}
}

Revision as of 10:47, 19 December 2012

Summary

Function: llListenControl( integer handle, integer active );

Makes listen event callback handle active or inactive

• integer handle handle to control listen event
• integer active TRUE activates, FALSE deactivates

Caveats

All Issues ~ Search JIRA for related Bugs

Examples

a small example of an on and off switchable listen by use of llListenControl() <LSL> integer handle; integer toggle; default {

   state_entry()
   {
       handle = llListen(5, "", NULL_KEY, "");    // Establish a listener to listen to anything on channel 5 ...
       llListenControl(handle, FALSE);            // ... but make the listener inactive for now
       llSetText("not listening", <0.0,0.0,0.0>, 1.0);
   }
   touch_start(integer total_number)
   {
       toggle = !toggle;
       llListenControl(handle, toggle);           // Make the listener active or inactive as required
       if(toggle)
       {
           llSay(0, "now listening on channel 5");
           llSetText("listening on ch 5", <1.0,0.0,0.0>, 1.0);
       }
       else
       {
           llSay(0, "not listening any more");
           llSetText("not listening", <0.0,0.0,0.0>, 1.0);
       }     
   }
   
   listen(integer channel, string name, key id, string message)
   {
       llSay(0, name + " just said " + message);
   }

}

</LSL>

See Also

Events

•  listen

Functions

•  llListen
•  llListenRemove

Deep Notes

Search JIRA for related Issues

Signature

function void llListenControl( integer handle, integer active );