Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

This is your land

Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
01-25-2010 03:29
Just made this script to check if you own a land or not, any comment?

CODE

default
{
state_entry()
{

}

touch_start(integer total_number)
{
list detailsreq = [PARCEL_DETAILS_OWNER, PARCEL_DETAILS_GROUP];
vector RegionBase = llGetPos() ;

list Details = llGetParcelDetails(RegionBase, detailsreq);
integer PrimsCount = llGetParcelPrimCount(RegionBase, PARCEL_COUNT_TOTAL, FALSE) ;

key Land_owner = llList2Key(Details, 0) ;
key Land_group = llList2Key(Details, 1) ;

if (llOverMyLand(llGetOwner()))
{
llOwnerSay("This is your land") ;
}
else if (Land_owner == Land_group)
{
if (PrimsCount ==0 )
{
llOwnerSay("cannot decide, you need at least 1 prim on the parcel to check") ;
}
else
{
list l = llGetParcelPrimOwners(RegionBase) ;
if (llGetListLength(l) > 0)
{
llOwnerSay("This is your group land") ;
}
else
{
llOwnerSay("This is not your land (no return rights).") ;
}
}
}
else
llOwnerSay("This is not your land") ;
}
}
Kayaker Magic
low carbonated footprint
Join date: 11 Sep 2008
Posts: 109
01-26-2010 11:32
Interesting. What are you planning to use this for? I use something like the following routine to detect if it is safe for an autonomous critter to llSetPos() to the desired position. (This is a hacked up version, not tested, I removed a bunch of extraneous stuff)

CODE

integer okfly(vector lookpos) //return true if lookpos is safe to move into
{
//stay away from the edges of the region
if (lookpos.x<=1 || lookpos.x>255 || lookpos.y<=1 || lookpos.y>255)
return FALSE;
if (onown(llGetLandOwnerAt(lookpos)==llGetOwner())) //if we are on our own property
return TRUE; //it is always safe
//use differnt algorithms for roaming other property
integer flags=llGetParcelFlags(lookpos);
if (flags&PARCEL_FLAG_USE_ACCESS_LIST) //if there is an access list
return FALSE; //I'm probably not on it.
//get owners active group at time of rezzing
key ogroup=llList2Key(llGetObjectDetails(llGetKey(),[OBJECT_GROUP]),0);
key pgroup=llList2Key(llGetParcelDetails(lookpos,[PARCEL_DETAILS_GROUP]),0);
//if they don't allow all scripts or
//if I'm not in the group or they don't allow group scripts I can't go there
if (!(flags&PARCEL_FLAG_ALLOW_SCRIPTS) &&
!((pgroup==ogroup)&&(flags&PARCEL_FLAG_ALLOW_GROUP_SCRIPTS))
)
return FALSE;
if (!(flags&PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY) &&
!((pgroup==ogroup)&&(flags&PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY))
)
return FALSE;
return TRUE; //passed the gauntlet, you can go there
}
Twisted Pharaoh
if ("hello") {"hey hey";}
Join date: 24 Mar 2007
Posts: 315
01-26-2010 21:20
I'm going to use it to register a land on a website. You don't want someone to register your land for you. My previous version was very clumsy, it used a deeded box that would send a chat message this one is better...

It fails if you are sitting on a prim dropped in a nearby land, so you need to check if the agent is sitting also. Maybe there are other issues, I don't know, please let me know if you find any.