Difference between revisions of "MySay"

From Second Life Wiki
Jump to navigation Jump to search
m (minor readability improvements)
m (<lsl> tag to <source>)
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
|p1_type=string|p1_name=objectName
|p1_type=string|p1_name=objectName
|p2_type=string|p2_name=msg
|p2_type=string|p2_name=msg
|return_type=string
|return_text=
|func_desc=Cleaner chat on a user's screen. Gives a less-cluttered, more professional looking output.
|func_desc=Cleaner chat on a user's screen. Gives a less-cluttered, more professional looking output.
|func_footnote=
|func_footnote=
<lsl>
<source lang="lsl2">
mySay(string objectName, string msg)
mySay(string objectName, string msg)
{
{
Line 18: Line 16:
     llSetObjectName(nameBeforeChange);
     llSetObjectName(nameBeforeChange);
}
}
</lsl>
</source>
See also: [[mySayOwner]], [[:Category:LSL_Chat]]
See also: [[mySayOwner]], [[:Category:LSL_Chat]]
|examples=
|examples=
<lsl>
<source lang="lsl2">
mySay("","Processing, please wait.");
mySay("","Processing, please wait.");
</lsl>
</source>
//user sees just:  17:04 Processing, please wait.<br />
//user sees just:  17:04 Processing, please wait.<br />
//You don't need to specify anything in the first parameter. The second one is limited to the normal chat limitation of a maximum of 255 bytes for that string. You may if you wish in the function swap in llWhisper or llShout.
//You don't need to specify anything in the first parameter. The second one is limited to the normal chat limitation of a maximum of 255 bytes for that string. You may if you wish in the function swap in llWhisper or llShout.
Line 29: Line 27:
If you have many different scripts in the same prim using mySay and competing at the same time for the object name, one might grab object name while it is blank, and then set it back to blank, wiping out the object name. This version compensates for that competition.
If you have many different scripts in the same prim using mySay and competing at the same time for the object name, one might grab object name while it is blank, and then set it back to blank, wiping out the object name. This version compensates for that competition.


<lsl>
<source lang="lsl2">
mySay(string objectName, string msg)
mySay(string objectName, string msg)
{
{
Line 42: Line 40:
     llSetObjectName(nameBeforeChange);
     llSetObjectName(nameBeforeChange);
}
}
</lsl>
</source>
|helpers
|helpers
|also_functions
|also_functions

Latest revision as of 15:28, 22 January 2015

Summary

Function: mySay( string objectName, string msg );

Cleaner chat on a user's screen. Gives a less-cluttered, more professional looking output.

• string objectName
• string msg

mySay(string objectName, string msg)
{
    string nameBeforeChange = llGetObjectName();

    llSetObjectName(objectName);
    llSay(PUBLIC_CHANNEL, "/me " + msg);

    llSetObjectName(nameBeforeChange);
}

See also: mySayOwner, Category:LSL_Chat

Examples

mySay("","Processing, please wait.");

//user sees just: 17:04 Processing, please wait.
//You don't need to specify anything in the first parameter. The second one is limited to the normal chat limitation of a maximum of 255 bytes for that string. You may if you wish in the function swap in llWhisper or llShout.

If you have many different scripts in the same prim using mySay and competing at the same time for the object name, one might grab object name while it is blank, and then set it back to blank, wiping out the object name. This version compensates for that competition.

mySay(string objectName, string msg)
{
    string nameBeforeChange = llGetObjectName();

    while (nameBeforeChange == "")
        nameBeforeChange = llGetObjectName();

    llSetObjectName(objectName);
    llSay(PUBLIC_CHANNEL, "/me " + msg);

    llSetObjectName(nameBeforeChange);
}

Notes

What this does:

Instead of users having their vision obscured by text like this covering half their screen:

[14:04] Animated Living Sofa Combo Couple & Solo 2.1e whispers: Lie F 1

They see just this:

[14:04] Lie F 1