Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

changed event not working

Robins Hermano
Registered User
Join date: 20 Oct 2006
Posts: 18
08-29-2007 18:35
I've got a linked object that accepts a notecard and then upon detection of a new notecard sends it to another object in the linked set, this is the code I have for that:

changed (integer change) {
if (change & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY) & passnotecard) {
passnotecard = FALSE;
integer numbernotes = llGetInventoryNumber(INVENTORY_NOTECARD);
llGiveInventory("a8e4d52e-e2bc-a27d-014f-be2141559fbd", llGetInventoryName(INVENTORY_NOTECARD, numbernotes - 1));
llWhisper(0, "Sending notecard for processing";);
}

I have the (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY) so that it detects a notecard if the owner does the drop or if someone else does and I have a corresponding llAllowInventoryDrop(TRUE) in my state_entry event. The passnotecard is set to TRUE in state_entry and then set to FALSE once the change event occurs to keep from entering into an infinite loop when the GiveInventory sends the notecard to the other linked object.

Anyway, the only time the changed event is triggered is when I (the owner) drops a notecard, if anyone else does, then it's not triggered.

I was hoping someone might see something really stupid that I've done but can't see since I've been staring at this so long.

Thanks in advance

Robins Hermano
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
08-29-2007 18:56
How about trying this:

if (passnotecard && (change & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY)))
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
08-30-2007 06:47
You're using "& passnotecard", instead of "&& passnotecard"...
Robins Hermano
Registered User
Join date: 20 Oct 2006
Posts: 18
Thank Lyn
08-30-2007 09:38
The extra & worked! How do you keep single vs. double && || etc, straight?

Robins
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
08-30-2007 11:33
Singles are operations. Doubles are comparisons.