OsGetRezzingObject

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Added note stating which version of OpenSim introduced this function)
(Add exemples)
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
|function_syntax=LSLString osGetRezzingObject()
+
|function_syntax=key osGetRezzingObject()
 
|threat_level=None
 
|threat_level=None
 
|permissions=true
 
|permissions=true
Line 7: Line 7:
 
Will return [[NULL_KEY]] if rezzed by agent or otherwise unknown source.
 
Will return [[NULL_KEY]] if rezzed by agent or otherwise unknown source.
 
Should only be reliable inside the on_rez event.
 
Should only be reliable inside the on_rez event.
 +
|ossl_example=<source lang="lsl">
 +
//
 +
// osGetRezzingObject Script Example
 +
// Author: djphil
 +
//
 +
 +
default
 +
{
 +
    on_rez(integer param)
 +
    {
 +
        key objectID = osGetRezzingObject();
 +
 +
        if (objectID == NULL_KEY)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "I was rezzed by agent or otherwise unknown source.");
 +
            llSay(PUBLIC_CHANNEL, "My rezzing object uuid is: " + objectID);
 +
        }
 +
 +
        else
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "I was rezzed by an object rezzer.");
 +
            llSay(PUBLIC_CHANNEL, "My rezzing object uuid is: " + objectID);
 +
            llSay(PUBLIC_CHANNEL, "My rezzing object name is: " + llKey2Name(objectID));
 +
        }
 +
    }
 +
}
 +
</source>
 +
'''Object Rezzer:'''
 +
<source lang="lsl">
 +
//
 +
// Object Rezzer Script Example
 +
// Author: djphil
 +
//
 +
 +
key objectID;
 +
integer switch;
 +
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        if (llGetInventoryNumber(INVENTORY_OBJECT))
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "Touch to see llRezObject usage.");
 +
        }
 +
 +
        else
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "Inventory object missing ...");
 +
        }
 +
    }
 +
 +
    touch_start(integer number)
 +
    {
 +
        if (switch =! switch)
 +
        {
 +
            llRezObject("Object", llGetPos() + <0.0, 0.0, 1.0>, ZERO_VECTOR, ZERO_ROTATION, 0);
 +
        }
 +
 +
        else
 +
        {
 +
            osDie(objectID);
 +
        }
 +
    }
 +
 +
    object_rez(key uuid)
 +
    {
 +
        objectID = uuid;
 +
    }
 +
}
 +
</source>
 
|additional_info=This function was added in 0.7.4-post-fixes
 
|additional_info=This function was added in 0.7.4-post-fixes
 
}}
 
}}

Latest revision as of 14:16, 30 November 2020

key osGetRezzingObject()
Get the key of the object that rezzed this object.

Will return NULL_KEY if rezzed by agent or otherwise unknown source. Should only be reliable inside the on_rez event.

Threat Level None
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// osGetRezzingObject Script Example
// Author: djphil
//
 
default
{
    on_rez(integer param)
    {
        key objectID = osGetRezzingObject();
 
        if (objectID == NULL_KEY)
        {
            llSay(PUBLIC_CHANNEL, "I was rezzed by agent or otherwise unknown source.");
            llSay(PUBLIC_CHANNEL, "My rezzing object uuid is: " + objectID);
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, "I was rezzed by an object rezzer.");
            llSay(PUBLIC_CHANNEL, "My rezzing object uuid is: " + objectID);
            llSay(PUBLIC_CHANNEL, "My rezzing object name is: " + llKey2Name(objectID));
        }
    }
}

Object Rezzer:

//
// Object Rezzer Script Example
// Author: djphil
//
 
key objectID;
integer switch;
 
default
{
    state_entry()
    {
        if (llGetInventoryNumber(INVENTORY_OBJECT))
        {
            llSay(PUBLIC_CHANNEL, "Touch to see llRezObject usage.");
        }
 
        else
        {
            llSay(PUBLIC_CHANNEL, "Inventory object missing ...");
        }
    }
 
    touch_start(integer number)
    {
        if (switch =! switch)
        {
            llRezObject("Object", llGetPos() + <0.0, 0.0, 1.0>, ZERO_VECTOR, ZERO_ROTATION, 0);
        }
 
        else
        {
            osDie(objectID);
        }
    }
 
    object_rez(key uuid)
    {
        objectID = uuid;
    }
}
Notes
This function was added in 0.7.4-post-fixes
Personal tools
General
About This Wiki