Difference between revisions of "LlListenControl"

From Second Life Wiki
Jump to navigation Jump to search
(added example)
Line 10: Line 10:
|caveats=*On [[state]] change or [[llResetScript|script reset]] all listens are removed automaticaly.
|caveats=*On [[state]] change or [[llResetScript|script reset]] all listens are removed automaticaly.
|constants
|constants
|examples
|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, "");
      llListenControl(handle, FALSE);
      llSetText("not listening", <0.0,0.0,0.0>,1.0);
    }
 
    touch_start(integer total_number)
    {
        toggle=!toggle;
        llListenControl(handle, toggle);
        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>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llListen]]}}
|also_functions={{LSL DefineRow||[[llListen]]}}

Revision as of 23:57, 24 August 2009

Summary

Function: llListenControl( integer number, integer active );
0.0 Forced Delay
10.0 Energy

Makes listen event callback number active or inactive

• integer number
• integer active boolean

Caveats

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, "");
      llListenControl(handle, FALSE);
      llSetText("not listening", <0.0,0.0,0.0>,1.0);
   }
   touch_start(integer total_number)
   {
       toggle=!toggle;
        llListenControl(handle, toggle);
       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

Signature

function void llListenControl( integer number, integer active );