Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Inventory Drop Question

SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
12-11-2004 17:37
Harris Hare asked me the following question and I don't know the answer:

How do you let the owner and only the owner do an inventory drop on an object they don't have modify permissions to?

I checked the wiki and found what seem to me to be contradictions in the docs:

In llAllowInventoryDrop the wiki says:


The changed event handler is called with the CHANGED_ALLOWED_DROP flag when an item is dropped onto the object by a user that is not the owner of the object. CHANGED_INVENTORY is passed to changed if the owner dropped the item.


But in the changed event section it says:


Constant: Value: Indicates:
CHANGED_INVENTORY 1 Indicates changed object inventory. This could include an item being added, removed, or renamed by anyone who has modify permissions on the object.

CHANGED_ALLOWED_DROP 64 Indicates that an item was dropped that was only allowed by the llAllowInventoryDrop function. This allows the object to identify items dropped by anyone who doesn't have modify permissions on the object.


One section refers to who owns the item while the other says who has modify permissions on the object.
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
12-11-2004 21:45
That's because there are 2 possible calls (flags) that can happen inside that event.

For example... if you gave me "global modify" permissions via my calling card, and i dropped something into the inventory of the object, the changed() event would be triggered. The changed will then be triggered under code like "if (changed == CHANGED_INVENTORY)". In this example, since i had modify permissions on your object, an llAllowInventoryDrop(TRUE) would not need to be set.

However, if you would like an object that would say... accept Notecards when any random avatar drops a notecard on it that doesn't have modify permissions, you would first need to allow them to drop something with llAllowInventoryDrop(TRUE). Then when they drop a notecard on the object, the changed() event handler will get triggered, and would look for a flag in code like "if (changed == CHANGED_ALLOW_DROP)". However, that code would not be triggered if YOU dropped a notecard on the object. Maybe this example can help you understand it better:

CODE
 default{
state_entry(){
llAllowInventoryDrop(TRUE);
}

changed( integer c ){
if( c == CHANGED_ALLOWED_DROP ){ // fires when a person other then owner or a person without object permissions drops a card
llSay( 0, "Someone without Permissions dropped something on me!" );
}
else if( c == CHANGED_INVENTORY ){ // fires when the owner or someone with permissions drops a card
llSay( 0, "Someone with Permissions changed my inventory!" );
}
}
}


! warning this was 'air coded' but it should get you to understand how it works. Note that if "AllowInventoryDrop(FALSE)" is called, then that will NOT allow people to drop things in the inventory (who don't have modify perms)

So to answer your original question... even if they don't have 'modify' permissions... they are still the OWNER of the object... so you would then use the CHANGED_INVETNORY flag.

Hope this helps

--Water
_____________________
From: Philip Linden

For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
12-11-2004 23:29
From: Water Rogers

CODE
 default{
state_entry(){
llAllowInventoryDrop(TRUE);
}

changed( integer c ){
if( c == CHANGED_ALLOWED_DROP ){ // fires when a person other then owner or a person without object permissions drops a card
llSay( 0, "Someone without Permissions dropped something on me!" );
}
else if( c == CHANGED_INVENTORY ){ // fires when the owner or someone with permissions drops a card
llSay( 0, "Someone with Permissions changed my inventory!" );
}
}
}



Have you verified that CHANGED_INVENTORY gets thrown when the owner does not have mod permissions? I haven't tested this but i was under the beliefe that if the owner didn't have mod permissions on the object that CHANGED_ALLOWED_DROP would be thrown instead of CHANGED_INVENTORY.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
12-12-2004 01:26
Good catch, Strife. You are correct... I worded that wrong, as it is late -- ALLOW_INVENTORY_DROP is fired if the object doesn't have modify permissions even if you are the owner. ( i was thinking if the script didn't have modify perms, but object did -- my bad )

Thanks for pointing that out!

--Water
_____________________
From: Philip Linden

For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
12-12-2004 15:48
From: SuezanneC Baskerville

How do you let the owner and only the owner do an inventory drop on an object they don't have modify permissions to?


The answer is you can't guaranty it. The closest thing you can do is have a touch event or listen that checks the owner then calls llAllowInventoryDrop(TRUE); and use a timer to revoke it.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey