Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Changed_Inventory bug?

Woopsy Dazy
Registered User
Join date: 12 Nov 2006
Posts: 173
01-30-2007 12:49
Please help me to confirm this before I bug-report it. I noticed that the changed-event doesn't trigger when I test the script with my other avatar. Works perfectly with the script creator/owner. This was while dropping one or more textures onto the prim using the CTRL-key, haven't tested any other inventory-objects.

CODE

default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
llAllowInventoryDrop(TRUE);
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
}
changed(integer change)
{
llSay(0, "Both see this!");
if (change == CHANGED_INVENTORY) //or &CHANGED_INVENTORY
{
llSay(0, "Only creator see's this!");
}
}
}




Weird I'd say. Or am I forgetting something?
Woopsy Dazy
Registered User
Join date: 12 Nov 2006
Posts: 173
01-30-2007 14:17
Reported. All I can see, it's a bug.
Elsewhere Essex
Registered User
Join date: 8 Sep 2006
Posts: 50
01-30-2007 14:28
actually, it's not a bug. read the wiki entry for llAllowedInventoryDrop().
if fires a seperate event for non-creator/owner dropped inventory
CHANGED_ALLOWED_DROP


you see the changed_inventory event as teh creator working on your stuff, because you have the naitive ability to drop inventory into an object you create
other users dropping inventory unered AllowedInventoryDrop will not fire changed_inventory and only the CHANEG_ALLOWED_DROP
Woopsy Dazy
Registered User
Join date: 12 Nov 2006
Posts: 173
01-30-2007 15:09
Essex is right! I blame myself for not reading the manual properly. Sorry Linden!

something like:

if (change & CHANGED_INVENTORY || CHANGED_ALLOW_DROP)

should do it.

Thx!

P.s.
Noticed some other tricky traps with changed-event. Changed-event is somewhat slow if script is within a laggy SIM. Don't expect changed to trigger for every item added to inventory. Add 20 textures in a quick SIM and u get 20 events. Add them in a slow SIM and u could get only 5. So take precautions in code.
Elsewhere Essex
Registered User
Join date: 8 Sep 2006
Posts: 50
01-30-2007 15:34
the best/easiest way to handel inventory changes to allow for full inventory progation reguardless of sim dilation is a timer.

CODE

changed(integer change) {
if (change == CHANGED_INVENTORY) {
llSetTimerEvent(5.0)
//sets a timer every inventory change.
//new timers over-ride old timers.
}
}
timer() {
process_inventory();
// the timer actually got to run so inventory has stablized;
//now remove the timer all together
llSetTimerEvent(0.0);
}


now, if a single inventory drop fires a change or multiple changes, it wont process the inventory till after 5 seconds of no chaged_inventory events.
note: 5 secs is the bare minimum and sometimes not enough ofa delay. 10 seconds seems more stable.