De DigiWiki.
// says beep to owner the first time owner says something in main chat;
integer listen_handle;
default
{
state_entry()
{ // Registers the listen to the owner of the object at the moment of the call.
// This does not automatically update when the owner changes.
// Change 0 to another positive number to listen for '/5 hello' style of chat.
listen_handle = llListen(0, "", llGetOwner(), "");
}
listen( integer channel, string name, key id, string message )
{
llOwnerSay("beep");
// Stop listening until script is reset
llListenRemove(listen_handle);
}
on_rez(integer param)
{ // Triggered when the object is rezzed, like after the object has been sold from a vendor
llResetScript();//By resetting the script on rez forces the listen to re-register.
}
changed(integer mask)
{ // Triggered when the object containing this script changes owner.
if(mask & CHANGED_OWNER)
{
llResetScript();
}
}
}