|
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
|
06-22-2009 07:22
How can I get a list of items in a prim's contents that are marked as no-modify? I do not care about the other permissions. The script will, or course, be in the prim.
_____________________
Visit ChereeMotion - Life's Best Pinup Poses http://slurl.com/secondlife/Wild%20Rice/38/230/51
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
06-22-2009 07:46
Make a loop that calls llGetInventoryName() and with the results, calls llGetInventoryPermMask(). If you're preparing an object for sale, you'll want to check next-owner permissions rather than current owner permissions. I generally do this in a script that deletes itself when done: llRemoveInventory(llGetScriptName()); Of course, leave that line out until you have it debugged. 
|
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
06-22-2009 08:10
From: Cheree Bury How can I get a list of items in a prim's contents that are marked as no-modify? I do not care about the other permissions. The script will, or course, be in the prim. The easiest way to answer is by giving you the script  default { state_entry() { list items=[]; integer no_perm ; integer mask = MASK_OWNER; // use 'MASK_NEXT' if you want next owners permissions string name; integer x = llGetInventoryNumber(INVENTORY_ALL); while (--x >= 0) { name = llGetInventoryName(INVENTORY_ALL, x); no_perm = ~llGetInventoryPermMask( name, mask ); if ( no_perm & PERM_MODIFY ) items += [name]; } llOwnerSay( "No Modify Inventory:\n"+llDumpList2String( items, "\n" )); } }
_____________________
From Studio Dora
|
|
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
|
06-22-2009 08:19
From: Dora Gustafson The easiest way to answer is by giving you the script  default { state_entry() { list items=[]; integer no_perm ; integer mask = MASK_OWNER; // use 'MASK_NEXT' if you want next owners permissions string name; integer x = llGetInventoryNumber(INVENTORY_ALL); while (--x >= 0) { name = llGetInventoryName(INVENTORY_ALL, x); no_perm = ~llGetInventoryPermMask( name, mask ); if ( no_perm & PERM_MODIFY ) items += [name]; } llOwnerSay( "No Modify Inventory:\n"+llDumpList2String( items, "\n" )); } }
This looks to be EXACTLY what I need. The whole bit-masking thing is what I always have problems with. It seems to always be just out of my brain's reach. Can't wait to get home to use it. Thank you so much.
_____________________
Visit ChereeMotion - Life's Best Pinup Poses http://slurl.com/secondlife/Wild%20Rice/38/230/51
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
06-22-2009 22:10
From: Cheree Bury This looks to be EXACTLY what I need. The whole bit-masking thing is what I always have problems with. It seems to always be just out of my brain's reach.
Can't wait to get home to use it.
Thank you so much. an easy way to think of bit fields is a line of 32 light switches... each light switch goes to a different permission... the constant names (bitmasks) are really just a label over one particular switch... and the variable you get back is just reporting which switches are on an which aren't. comparing them with AND(&  is like looking at the switch with that label, and seeing if it's been turned on. when you compare with OR(|) what you are really doing is turning on that labels switch if it isn't already which means when you put together a whole bunch of switch labels with OR(|) and then compare to something else with AND, you are really asking if ANY one of those switches is on. the neat part is that they (bitmasks and bitfields) are really the same thing (a number that represents them) so you can trade their position and still get the same results, or pretend one is the other without changing anything.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|