Difference between revisions of "Listener Script"

From Second Life Wiki
Jump to navigation Jump to search
(→‎Listener Script: Rewrote this terrible script. This library is referred to by new residents and those trying to learn LSL. What was here should NEVER be encouraged.)
(minor fix of example script and moved header into warning of breaking LL ToS)
Line 1: Line 1:
== Listener Script ==
== Listener Script ==


'''Use of this script without consent from those you listen to could constitute a breach of your agreement with Linden Labs (via the [http://secondlife.com/corporate/tos.php Terms of Service]) to abide by the [http://secondlife.com/corporate/cs.php Community Standards] of Second Life.'''
{{Warning|Use of this script without consent from those you listen to could constitute a breach of your agreement with Linden Labs (via the [http://secondlife.com/corporate/tos.php Terms of Service]) to abide by the [http://secondlife.com/corporate/cs.php Community Standards] of Second Life.}}


Put this in an object to listen to what people near the box are saying (like spying!) I am not responsible for people cheating on their partners, plots to kill people, etc.
Put this in an object to listen to what people near the box are saying (like spying!) I am not responsible for people cheating on their partners, plots to kill people, etc.


<lsl>//Listener script by Emmas Seetan
<lsl>
//21 September, 16:30
key owner;
///////////////////////////////////////////////
// Almost entirely rewritten by someone else //
// 24th March 2010 //


key owner;
default
default
{
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
            llResetScript();
    }
     state_entry()
     state_entry()
     {
     {
         owner = llGetOwner();
         owner = llGetOwner();
         llListen(0, "", "", "");
 
        // PUBLIC_CHANNEL has the integer value 0
         llListen(PUBLIC_CHANNEL, "", NULL_KEY, "");
     }
     }
     listen(integer channel, string name, key id, string message)
     listen(integer channel, string name, key id, string message)
     {
     {
         llInstantMessage(owner, name + " said: \"" + message + "\"");
         llInstantMessage(owner, name + " said: '" + message + "'");
     }
     }
}</lsl>
}
</lsl>

Revision as of 13:59, 7 October 2012

Listener Script

Warning!

Use of this script without consent from those you listen to could constitute a breach of your agreement with Linden Labs (via the Terms of Service) to abide by the Community Standards of Second Life.


Put this in an object to listen to what people near the box are saying (like spying!) I am not responsible for people cheating on their partners, plots to kill people, etc.

<lsl> key owner;

default {

   on_rez(integer start_param)
   {
       llResetScript();
   }
   changed(integer change)
   {
       if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
           llResetScript();
   }
   state_entry()
   {
       owner = llGetOwner();
       // PUBLIC_CHANNEL has the integer value 0
       llListen(PUBLIC_CHANNEL, "", NULL_KEY, "");
   }
   listen(integer channel, string name, key id, string message)
   {
       llInstantMessage(owner, name + " said: '" + message + "'");
   }

} </lsl>