LlGetParcelFlags: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Strife Onizuka (talk | contribs)
No edit summary
m Replace Template:SourceLink/bitbucket with SourceLink:github
 
(32 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL Function/position|pos|region=noZ}}
|func_id=317|func_sleep=0.0|func_energy=10.0
|func_id=317|func_sleep=0.0|func_energy=10.0
|func=llGetParcelFlags|return_type=integer|p1_type=vector|p1_name=pos
|func=llGetParcelFlags
|func_footnote
|p1_type=vector|p1_name=pos
|func_footnote=Both {{LSLP|x}} and {{LSLP|y}} components of {{LSLP|pos}} are clamped to the range {{Interval|gte=0.0|lte=256.0|center=component}}, the {{LSLP|z}} component is ignored.
|func_desc
|func_desc
|return_text=that is the parcel flags (PARCEL_FLAG_*) for the parcel including the point pos.
|return_type=integer
|return_subtype=bit field
|return_text=of parcel flags (PARCEL_FLAG_*) for the parcel that includes the point {{LSLP|pos}}.
|spec
|spec
|caveats
|caveats
|constants={{{!}} {{Prettytable}}
|constants={{LSL_Constants/Parcel}}
! Flag
|examples=
! Value
<source lang="lsl2">
! Description
if (!(llGetParcelFlags(llGetPos()) & PARCEL_FLAG_ALLOW_FLY))
{{!}}-
    llSay(0,"You are not allowed to fly here!, Sorry!.");
{{!}} {{LSLG|PARCEL_FLAG_ALLOW_FLY}}
 
{{!}} {{LSL Hex|0x1|1}}
// Answers TRUE if rezzing is permitted, FALSE if not.
{{!}} find if a parcel allows flying
// Rezzing can fail even if this returns TRUE due to parcel full or server errors.
{{!}}-
// Rezzing will always fail if this returns FALSE
{{!}} {{LSLG|PARCEL_FLAG_ALLOW_SCRIPTS}}
integer canRezAt(vector pos) {
{{!}} {{LSL Hex|0x2|2}}
    integer parcelFlags = llGetParcelFlags(pos);
{{!}} find if a parcel allows outside [[script|scripts]]
    list parcelDetails = llGetParcelDetails(pos, [PARCEL_DETAILS_OWNER, PARCEL_DETAILS_GROUP]);
{{!}}-
    key parcelOwner = llList2Key(parcelDetails, 0);
{{!}} {{LSLG|PARCEL_FLAG_ALLOW_LANDMARK}}
    key parcelGroup = llList2Key(parcelDetails, 1);
{{!}} {{LSL Hex|0x8|8}}
{{!}} find if a parcel allows [[landmark|landmarks]] to be created
    if (parcelFlags & PARCEL_FLAG_ALLOW_CREATE_OBJECTS) return TRUE;
{{!}}-
    if (parcelOwner == llGetOwner()) return TRUE;
{{!}} {{LSLG|PARCEL_FLAG_ALLOW_TERRAFORM}}
    if (!llSameGroup(parcelGroup)) return FALSE;
{{!}} {{LSL Hex|0x10|16}}
    if (parcelFlags & PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS) return TRUE;
{{!}} find if a parcel allows anyone to terraform the [[land]]
    return FALSE;
{{!}}-
}
{{!}} {{LSLG|PARCEL_FLAG_ALLOW_DAMAGE}}
{{!}} {{LSL Hex|0x20|32}}
// Answers TRUE if running scripts is permitted, FALSE if not
{{!}} find if a parcel allows [[damage]]
integer canRunScriptsAt(vector pos) {
{{!}}-
    integer parcelFlags = llGetParcelFlags(pos);
{{!}} {{LSLG|PARCEL_FLAG_ALLOW_CREATE_OBJECTS}}
    list parcelDetails = llGetParcelDetails(pos, [PARCEL_DETAILS_OWNER, PARCEL_DETAILS_GROUP]);
{{!}} {{LSL Hex|0x40|64}}
    key parcelOwner = llList2Key(parcelDetails, 0);
{{!}} find if a parcel allows anyone to create [[object|objects]]
    key parcelGroup = llList2Key(parcelDetails, 1);
{{!}}-
{{!}} {{LSLG|PARCEL_FLAG_USE_ACCESS_GROUP}}
    if (parcelFlags & PARCEL_FLAG_ALLOW_SCRIPTS) return TRUE;
{{!}} {{LSL Hex|0x100|256}}
    if (parcelOwner == llGetOwner()) return TRUE;
{{!}} find if a parcel limits access to a [[group]]
    if (!llSameGroup(parcelGroup)) return FALSE;
{{!}}-
    if (parcelFlags & PARCEL_FLAG_ALLOW_GROUP_SCRIPTS) return TRUE;
{{!}} {{LSLG|PARCEL_FLAG_USE_ACCESS_LIST}}
    return FALSE;
{{!}} {{LSL Hex|0x200|512}}
}
{{!}} find if a parcel limits access to a list of [[resident|residents]]
</source>
{{!}}-
{{!}} {{LSLG|PARCEL_FLAG_USE_BAN_LIST}}
{{!}} {{LSL Hex|0x400|1024}}
{{!}} find if a parcel uses a ban list, including restricting access based on payment info
{{!}}-
{{!}} {{LSLG|PARCEL_FLAG_USE_LAND_PASS_LIST}}
{{!}} {{LSL Hex|0x800|2048}}
{{!}} find if a parcel allows passes to be purchased
{{!}}-
{{!}} {{LSLG|PARCEL_FLAG_LOCAL_SOUND_ONLY}}
{{!}} {{LSL Hex|0x8000|32768}}
{{!}} find if a parcel restricts spatialized [[sound]] to the parcel
{{!}}-
{{!}} {{LSLG|PARCEL_FLAG_RESTRICT_PUSHOBJECT}}
{{!}} {{LSL Hex|0x200000|2097152}}
{{!}} find if a parcel restricts {{LSLG|llPushObject}}
{{!}}}
|examples
|helpers
|helpers
|also_functions
|also_tests=
{{LSL DefineRow||[[llGetParcelFlags Test]]}}
|also_functions=
{{LSL DefineRow||[[llGetParcelDetails]]}}
{{LSL DefineRow||[[llGetRegionFlags]]}}
|also_events
|also_events
|also_tests
|also_tests
|also_articles
|also_articles
|location={{SourceLink/github|viewer|indra/llinventory/llparcelflags.h}}
|notes
|notes
|permission
|cat1=Parcel
|negative_index
|sort=GetParcelFlags
|cat1
|cat2
|cat2
|cat3
|cat3
|cat4
|cat4
}}
}}

Latest revision as of 15:09, 17 November 2022

Summary

Function: integer llGetParcelFlags( vector pos );
0.0 Forced Delay
10.0 Energy

Returns a bit field (an integer) of parcel flags (PARCEL_FLAG_*) for the parcel that includes the point pos.

• vector pos position in region coordinates (z component is ignored)

Both x and y components of pos are clamped to the range [0.0, 256.0], the z component is ignored.

Flag Value Description
PARCEL_FLAG_ALLOW_FLY 0x00000001 find if a parcel allows flying
PARCEL_FLAG_ALLOW_SCRIPTS 0x00000002 find if a parcel allows outside scripts
PARCEL_FLAG_ALLOW_LANDMARK 0x00000008 find if a parcel allows landmarks to be created
PARCEL_FLAG_ALLOW_TERRAFORM 0x00000010 find if a parcel allows anyone to terraform the land
PARCEL_FLAG_ALLOW_DAMAGE 0x00000020 find if a parcel allows damage
PARCEL_FLAG_ALLOW_CREATE_OBJECTS 0x00000040 find if a parcel allows anyone to create objects
PARCEL_FLAG_USE_ACCESS_GROUP 0x00000100 find if a parcel limits access to a group
PARCEL_FLAG_USE_ACCESS_LIST 0x00000200 find if a parcel limits access to a list of residents
PARCEL_FLAG_USE_BAN_LIST 0x00000400 find if a parcel uses a ban list, including restricting access based on payment info
PARCEL_FLAG_USE_LAND_PASS_LIST 0x00000800 find if a parcel allows passes to be purchased
PARCEL_FLAG_LOCAL_SOUND_ONLY 0x00008000 find if a parcel restricts spatialized sound to the parcel
PARCEL_FLAG_RESTRICT_PUSHOBJECT 0x00200000 find if a parcel restricts llPushObject
PARCEL_FLAG_ALLOW_GROUP_SCRIPTS 0x02000000 find if a parcel allows scripts owned by group
PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS 0x04000000 find if a parcel allows object creation by group members or objects
PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY 0x08000000 find if a parcel allows all objects to enter a parcel
PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY 0x10000000 find if a parcel only allows group (and owner) objects to enter the parcel

Examples

if (!(llGetParcelFlags(llGetPos()) & PARCEL_FLAG_ALLOW_FLY))
    llSay(0,"You are not allowed to fly here!, Sorry!.");

// Answers TRUE if rezzing is permitted, FALSE if not.
// Rezzing can fail even if this returns TRUE due to parcel full or server errors.
// Rezzing will always fail if this returns FALSE
integer canRezAt(vector pos) {
    integer parcelFlags = llGetParcelFlags(pos);
    list parcelDetails = llGetParcelDetails(pos, [PARCEL_DETAILS_OWNER, PARCEL_DETAILS_GROUP]);
    key parcelOwner = llList2Key(parcelDetails, 0);
    key parcelGroup = llList2Key(parcelDetails, 1);
 
    if (parcelFlags & PARCEL_FLAG_ALLOW_CREATE_OBJECTS) return TRUE;
    if (parcelOwner == llGetOwner()) return TRUE;
    if (!llSameGroup(parcelGroup)) return FALSE;
    if (parcelFlags & PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS) return TRUE;
    return FALSE;
}
 
// Answers TRUE if running scripts is permitted, FALSE if not
integer canRunScriptsAt(vector pos) {
    integer parcelFlags = llGetParcelFlags(pos);
    list parcelDetails = llGetParcelDetails(pos, [PARCEL_DETAILS_OWNER, PARCEL_DETAILS_GROUP]);
    key parcelOwner = llList2Key(parcelDetails, 0);
    key parcelGroup = llList2Key(parcelDetails, 1);
 
    if (parcelFlags & PARCEL_FLAG_ALLOW_SCRIPTS) return TRUE;
    if (parcelOwner == llGetOwner()) return TRUE;
    if (!llSameGroup(parcelGroup)) return FALSE;
    if (parcelFlags & PARCEL_FLAG_ALLOW_GROUP_SCRIPTS) return TRUE;
    return FALSE;
}

See Also

Functions

•  llGetParcelDetails
•  llGetRegionFlags

Deep Notes

Tests

•  llGetParcelFlags Test

Source

Footnotes

  1. ^ The ranges in this article are written in Interval Notation.

Signature

function integer llGetParcelFlags( vector pos );