LSL Function Style/SignpostMarv Martin

From Second Life Wiki
Jump to: navigation, search
These templates are designed to be modular, making them easier to drop in wherever or however needed- with an emphasis on flexibility rather than rigid page structure; Layouts for different types of functions might be better suited to slightly different layouts. To make it easier for newcomers to LSL and the MediaWiki syntax, users of these templates will be encouraged to maintain the design with their own MediaWiki code, as most of the templates are for data display only.

List of templates

Shortcut templates

Data lookup templates

These are likely to be incomplete, it would be handy if contributions could be made to them to improve their completeness. However, please refrain from adding any functions which have "0.0" as their delay value for now.

Implementations To view the source code for each implementation, navigate to the "Edit" link for each example.

llAbs

integer llAbs (integer val)

llAbs returns the distance of the integer val from 0. This function will be useful if the result of an operation or function is not guaranteed to be a positive integer or negative integer.

llFabs is the equivalent function to use when the result of an operation or function is known to be always or occasionally a float, although the result of such an operation or function could be typecast to an integer

Examples

llAbs(-5); //returns 
llAbs(3); // returns 3
llAbs((integer)-7.99); //returns 7

[[Category:Math]]

llInstantMessage

llInstantMessage (key Resident, string message)

llInstantMessage sends string message to key Resident.

  • key Resident must be the UUID of a Resident; this function cannot be used to send messages to objects- for that purpose you will need llEmail or llMessageLinked depending on whether or not you wish to communicate with a child prim or prim not in the linkset of the an object.
  • string message is limited to 1023 bytes. If the message is longer, message is truncated to 1023 bytes (bare this in mind when using multi-byte characters). llStringLength can be used to help indicate whether the message will be truncated.
  • llInstantMessage incurs a delay of 2.0 seconds. If you wish to communicate solely with the owner of the object, llOwnerSay may be more suitable.
  • llInstantMessage does not currently result in the message being displayed in the Resident's Instant Message window; Messages are displayed in the History window.
  • Remember to use this function responsibly. Automated messages can be considered "SPAM" and/or harrasment, which violates the LL:Second Life Community Standards and may result in disciplinary measures.

Examples

key owner = NULL_KEY;
string Resident;

default
{
    changed(integer change)
    {
        if((change & CHANGED_OWNER) && (llGetOwner() != owner))
        {
            if(owner != NULL_KEY)
            {
                llInstantMessage(llGetCreator(),Resident + " gave their copy of " + llGetObjectName() + " to " + llKey2Name(llGetOwner()) + "."); // Instant Messages the creator of the object with something along the lines of "SignpostMarv Martin gave their copy of Object to Orientation Islander."
                owner = llGetOwner();
                Resident = llKey2Name(owner);
            }
            else
            {
                owner = llGetOwner();
                Resident = llKey2Name(owner);
            }
        }
    }
}

[[Category:Communications]] [[Category:Resident Communications]]