User/Digit Ditko/experience transport script

From Second Life Wiki
< User
Revision as of 10:29, 17 August 2015 by Digit Ditko (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Transport an avatar and use experience permissions

// use a regoins coordinates here to transport avatar to another region.
vector gRegion = ZERO_VECTOR; 
 
// region specific location
vector gPos = <128.0, 128.0, 100.0>;
 
// Avatar will face this direction
vector gLookAt = <0.0, 0.0, 0.0>;
 
 
// -----------------------------------------------------------------------------
// Default state
default
{
    collision_start (integer inNumDetected)
    { 
        integer i;
        for (i = 0; i < inNumDetected; i++)
        {
            llRequestExperiencePermissions (llDetectedKey (i), "");
        }
    }
 
    experience_permissions (key inAvatar)
    {   
        if (gRegion == ZERO_VECTOR)
        {
            llTeleportAgent (inAvatar, "", gPos, gLookAt); 
        }   
        else
        {
            llTeleportAgentGlobalCoords (inAvatar, gRegion, gPos, gLookAt);
        }
    }
 
 
    on_rez (integer inParam)
    {
        llResetScript ();
    }
 
 
    changed (integer inMask)
    {   
        if (inMask & (CHANGED_INVENTORY | CHANGED_OWNER))
        {
            llResetScript ();
        }      
    }
}