Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Trying to wrap my brain around llGetInventoryPermMask

Darkness Anubis
Registered User
Join date: 14 Jun 2004
Posts: 1,628
05-02-2007 00:08
I am trying to detect by script if a texture within an object is copyable or not. this is the setup

CODE
texturename = llGetInventoryName(INVENTORY_TEXTURE,    counter);
perms = llGetInventoryPermMask(texturename, PERM_COPY);
if (perms = PERM_COPY)
{
llSetTexture(texturename,1);
llSetText(texturename, <1,1,1>, 1);

}
else
{
llSetTexture("07d876d9-02d4-7381-5f2b-956e015f5fca",1);
llSetText(texturename, <1,1,1>, 1);
}


problem is it is constantly coming up with the texture as copyable even if it is not.

Semi novice scriptor badly need of help. Thanks Much

ok also need help on how to post the script snippet properly. Thanks again
_____________________
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
05-02-2007 04:14
This line:

CODE

if (perms = PERM_COPY)
Isn't testing the variable perms for equality to the constant PERM_COPY, it is assigning the value of PERM_COPY to the variable perms, then evaluating it. Since PERM_COPY is non-zero, it is evaluated as TRUE.

Normally, you'd just replace = with == , but when evaluating bitfields, you want to test with the bitwise & operator:

CODE

if (perms & PERM_COPY)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-02-2007 04:33
To post code use [ php ] code [ /php ] but without the spaces
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
05-02-2007 08:00
You're also checking in the wrong manner...you might want to review again the Wiki in regards to the function

llGetInventoryPermMask()

(unfortnately, the main wiki was taking forever to load, so I inserted a link to one of the mirrors listed on the LSL Portal)

You'll need to:

CODE

perms = llGetInventoryPermMask(texturename, MASK_OWNER);

//then later

if(perms & PERM_COPY)


Basically, when you get the perm mask, you have to declare who you're getting it for--current owner, next owner, etc. THEN you can test if that perm set has PERM_COPY in it. Hope that helps.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Darkness Anubis
Registered User
Join date: 14 Jun 2004
Posts: 1,628
05-02-2007 10:49
Thanks so much everyone. I think where I was getting all turned around is in exactly what the call returned. That was far from clear to me on the wiki since there is no example code.

You guys got me straighten out perfectly!
:D
_____________________