Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetParcelFlags how does it work

trustycrusty Avro
Registered User
Join date: 12 Dec 2007
Posts: 4
06-28-2008 11:18
Hi all first post so go easy:

I am working on a Drone/Bot that flies around the sim.

It gets its current position and calculates its new position, but before it moves to the new position I need to know if it can enter the parcel, if it cant it works out a new position.

The parcel needs to be able to run scripts and allow object entery.

I have looked at llGetParcelFlags but I don’t get how this works.

Can you give me some pointers?

Taken from http://wiki.secondlife.com/wiki/LSL_llGetParcelFlags

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

The above did not work
Laurence Corleone
Registered User
Join date: 12 Oct 2006
Posts: 126
06-28-2008 11:40
Without seeing the rest of the code that went around that snippet, it is hard to see of you actually used it correctly.

From:
http://lslwiki.net/lslwiki/wakka.php?wakka=llGetParcelFlags

CODE

// Show all the parcel flags for land the object is currently over.
default
{
state_entry ()
{
integer Parcel_Flags = llGetParcelFlags(llGetPos ());
if (PARCEL_FLAG_ALLOW_FLY & Parcel_Flags)
{
llOwnerSay ("Parcel allows flying.");
}
if (PARCEL_FLAG_ALLOW_SCRIPTS & Parcel_Flags)
{
llOwnerSay ("Parcel allows outside scripts.");
}
if (PARCEL_FLAG_ALLOW_TERRAFORM & Parcel_Flags)
{
llOwnerSay ("Parcel allows terraforming.");
}
if (PARCEL_FLAG_ALLOW_DAMAGE & Parcel_Flags)
{
llOwnerSay ("Parcel allows damage.");
}
if (PARCEL_FLAG_ALLOW_CREATE_OBJECTS & Parcel_Flags)
{
llOwnerSay ("Parcel allows creating objects.");
}
if (PARCEL_FLAG_USE_ACCESS_GROUP & Parcel_Flags)
{
llOwnerSay ("Parcel limits access to a group.");
}
if (PARCEL_FLAG_USE_ACCESS_LIST & Parcel_Flags)
{
llOwnerSay ("Parcel limits access to a list of residents .");
}
if (PARCEL_FLAG_USE_BAN_LIST & Parcel_Flags)
{
llOwnerSay ("Parcel uses a ban list.");
}
if (PARCEL_FLAG_USE_LAND_PASS_LIST & Parcel_Flags)
{
llOwnerSay ("Parcel allows passes to be purchased.");
}
if (PARCEL_FLAG_LOCAL_SOUND_ONLY & Parcel_Flags)
{
llOwnerSay ("Parcel restricts spatialised sound to the parcel.");
}
if (PARCEL_FLAG_RESTRICT_PUSHOBJECT & Parcel_Flags)
{
llOwnerSay ("Parcel restricts llPushObject.");
}
}
touch_end (integer n)
{
llResetScript ();
}
}


I know for a fact that works but it is looking for what IS allowed. Your snippet is looking for what ISN'T allowed which would make the script I posted look like:
CODE

// Show all the parcel flags for land the object is currently over.
default
{
state_entry ()
{
integer Parcel_Flags = llGetParcelFlags(llGetPos ());
if (!(PARCEL_FLAG_ALLOW_FLY & Parcel_Flags))
{
llOwnerSay ("Parcel does not flying.");
}
if (!(PARCEL_FLAG_ALLOW_SCRIPTS & Parcel_Flags))
{
llOwnerSay ("Parcel does not allow outside scripts.");
}
if (!(PARCEL_FLAG_ALLOW_TERRAFORM & Parcel_Flags))
{
llOwnerSay ("Parcel does not allow terraforming.");
}
if (!(PARCEL_FLAG_ALLOW_DAMAGE & Parcel_Flags))
{
llOwnerSay ("Parcel does not allow damage.");
}
if (!(PARCEL_FLAG_ALLOW_CREATE_OBJECTS & Parcel_Flags))
{
llOwnerSay ("Parcel does not allow creating objects.");
}
if (!(PARCEL_FLAG_USE_ACCESS_GROUP & Parcel_Flags))
{
llOwnerSay ("Parcel does not limit access to a group.");
}
if (!(PARCEL_FLAG_USE_ACCESS_LIST & Parcel_Flags))
{
llOwnerSay ("Parcel does not limit access to a list of residents .");
}
if (!(PARCEL_FLAG_USE_BAN_LIST & Parcel_Flags))
{
llOwnerSay ("Parcel uses a ban list.");
}
if (PARCEL_FLAG_USE_LAND_PASS_LIST & Parcel_Flags)
{
llOwnerSay ("Parcel does not allow passes to be purchased.");
}
if (!(PARCEL_FLAG_LOCAL_SOUND_ONLY & Parcel_Flags))
{
llOwnerSay ("Parcel does not restrict spatialised sound to the parcel.");
}
if (!(PARCEL_FLAG_RESTRICT_PUSHOBJECT & Parcel_Flags))
{
llOwnerSay ("Parcel does not restrict llPushObject.");
}
}
touch_end (integer n)
{
llResetScript ();
}
}


:edit to add:
By the way, in my first example, if any one of the conditions is NOT true the script will NOT give you a reply on that particular flag and opposite for the second example.

If you tried using your posted snippet in a parcel that DOES allow flying you would not have gotten a reply.
_____________________
There are no stupid questions, just stupid people.
trustycrusty Avro
Registered User
Join date: 12 Dec 2007
Posts: 4
Many Thanks
06-28-2008 12:09
Thanks Laurence Corleone

Thats just what i need...i'll try it in world later.
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
06-28-2008 14:34
what your doing in theroy may work but im not sure if you can detect single areas you may be able to wire in a sensor that detects parcels that are around the drone and relays it back but ya... i have to acculy try it in my 1/2 scripted flying gun XD