Difference between revisions of "LlOwnerSay"

From Second Life Wiki
Jump to: navigation, search
m (<lsl> tag to <source>)
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{LSL_Function/limits}}{{LSL_Function
+
{{LSL_Function
 +
|inject-2={{LSL_Function/limits}}{{LSL_Function/chat||msg}}
 
|func_id=292|func_sleep=0.0|func_energy=10.0
 
|func_id=292|func_sleep=0.0|func_energy=10.0
 
|func=llOwnerSay|p1_type=string|p1_name=msg
 
|func=llOwnerSay|p1_type=string|p1_name=msg
|func_desc=Says '''msg''' to the owner only.
+
|func_desc=Says {{LSLP|msg}} to the object's owner only, if the owner is currently in the same [[region]].
 
|return_text
 
|return_text
 
|spec
 
|spec
 
|caveats=
 
|caveats=
* If '''msg''' is longer than 1023 bytes, it will be truncated to 1023 bytes.
+
* If {{LSLP|msg}} is longer than 1024 bytes, it will be truncated to 1024 bytes. This can convey 1024 ASCII characters, or fewer if non-ASCII are present.
* Silently fails if '''msg''' is empty, even if the owner is in the region the object is in (bug ?).
+
 
* Silently fails ~45 seconds after the owner leaves the region the object is in.
 
* Silently fails ~45 seconds after the owner leaves the region the object is in.
 
* Silently fails when the object to which the script is attached is [[deed]]ed to a group.
 
* Silently fails when the object to which the script is attached is [[deed]]ed to a group.
 +
* Some viewers do not display llOwnerSay text when {{LSLP|msg}} is empty ({{String}}).
 +
* Produces swirly particle effects for the owner (who sees the message) but these effects do not appear to be visible to other avatars (who don't).
 
|constants
 
|constants
|examples=<lsl>default
+
|examples=
 +
<source lang="lsl2">
 +
default
 
{
 
{
     touch_start(integer total_number)
+
     touch_start(integer num_detected)
 
     {
 
     {
         llOwnerSay("Ouch!" );
+
         llOwnerSay("Ouch!");
 
     }
 
     }
}</lsl>
+
}
 +
</source>
 
|helpers=
 
|helpers=
<lsl> //-- llOwnerSay extension for preventing silent failures
+
<source lang="lsl2">
//-- paste this code at the top of the script and replace
+
// llOwnerSay extension for preventing silent failures
//--  any calls to llOwnerSay below it with uOwnerSayPlus
+
// paste this code at the top of the script and replace
uOwnerSayPlus( string vStrMsg ){
+
// any calls to llOwnerSay with uOwnerSayPlus
key owner = llGetOwner();
+
 
if (llKey2Name( owner )){
+
uOwnerSayPlus(string inputString)
llOwnerSay( vStrMsg ); //-- single owner that the region still has a handle for
+
{
}else if (llList2Key( llGetObjectDetails( llGetKey(), [OBJECT_GROUP] ), 0 ) == owner){
+
    key owner = llGetOwner();
llWhisper( 0, "/me : " +vStrMsg ); //-- group owned, must send the message publicly
+
 
}else{
+
    // single owner that the region still has a handle for
llInstantMessage( owner, vStrMsg ); //-- single owner, not present, send them an IM
+
    if (llKey2Name(owner))
}
+
    {
}</lsl>
+
        llOwnerSay(inputString);
 +
    }
 +
    // group owned, must send the message publicly
 +
    else if (llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0) == owner)
 +
    {
 +
        llWhisper(0, "/me : " + inputString);
 +
    }
 +
    // single owner, not present, send them an IM
 +
    else
 +
    {
 +
        llInstantMessage(owner, inputString);
 +
    }
 +
}
 +
</source>
 
|also_functions=
 
|also_functions=
 
{{LSL DefineRow||[[llRegionSay]]|Sends chat region wide}}
 
{{LSL DefineRow||[[llRegionSay]]|Sends chat region wide}}
Line 37: Line 55:
 
{{LSL DefineRow||[[llSay]]|Sends chat limited to 20 meters}}
 
{{LSL DefineRow||[[llSay]]|Sends chat limited to 20 meters}}
 
{{LSL DefineRow||[[llShout]]|Sends chat limited to 100 meters}}
 
{{LSL DefineRow||[[llShout]]|Sends chat limited to 100 meters}}
{{LSL DefineRow||[[llInstantMessage]]|}}
+
{{LSL DefineRow||[[llRegionSayTo]]|Sends private chat region wide}}
 +
{{LSL DefineRow||[[llInstantMessage]]|Sends private chat anywhere on the grid}}
 
|also_events
 
|also_events
 
|also_tests=
 
|also_tests=
Line 46: Line 65:
 
|negative_index
 
|negative_index
 
|cat1=Communications
 
|cat1=Communications
 +
|haiku={{Haiku|Speak to me only.|Murmur secrets in my ear:|Clandestine whispers.}}
 
|cat2
 
|cat2
 
|cat3
 
|cat3
 
|cat4
 
|cat4
 
}}
 
}}

Latest revision as of 14:06, 22 January 2015

Summary

Function: llOwnerSay( string msg );

Says msg to the object's owner only, if the owner is currently in the same region.

• string msg message to be transmitted

Caveats

  • If msg is longer than 1024 bytes, it will be truncated to 1024 bytes. This can convey 1024 ASCII characters, or fewer if non-ASCII are present.
  • Silently fails ~45 seconds after the owner leaves the region the object is in.
  • Silently fails when the object to which the script is attached is deeded to a group.
  • Some viewers do not display llOwnerSay text when msg is empty ("").
  • Produces swirly particle effects for the owner (who sees the message) but these effects do not appear to be visible to other avatars (who don't).
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    touch_start(integer num_detected)
    {
        llOwnerSay("Ouch!");
    }
}

Useful Snippets

// llOwnerSay extension for preventing silent failures
// paste this code at the top of the script and replace
// any calls to llOwnerSay with uOwnerSayPlus
 
uOwnerSayPlus(string inputString)
{
    key owner = llGetOwner();
 
    // single owner that the region still has a handle for
    if (llKey2Name(owner))
    {
        llOwnerSay(inputString);
    }
    // group owned, must send the message publicly
    else if (llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0) == owner)
    {
        llWhisper(0, "/me : " + inputString);
    }
    // single owner, not present, send them an IM
    else
    {
        llInstantMessage(owner, inputString);
    }
}

See Also

Functions

•  llRegionSay Sends chat region wide
•  llWhisper Sends chat limited to 10 meters
•  llSay Sends chat limited to 20 meters
•  llShout Sends chat limited to 100 meters
•  llRegionSayTo Sends private chat region wide
•  llInstantMessage Sends private chat anywhere on the grid

Articles

•  Limits SL limits and constrictions

Deep Notes

Search JIRA for related Issues

Tests

• llOwnerSay Test

Signature

function void llOwnerSay( string msg );

Haiku

Speak to me only.
Murmur secrets in my ear:
Clandestine whispers.