Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

link_message event in root prim not called when scripts in child prims are changed

Laronzo Fitzgerald
Registered User
Join date: 20 Apr 2007
Posts: 6
08-10-2008 09:23
Hi guys - I'm a little stuck here, any fresh eyes on this would be awesome =)

Scripts in child prims of my linked set send a linked message to the root prim on touch. This fires link_message in the root prim which validates the detected key against a list of keys and returns a llMessageLinked to the source child prim.

This works fine until a child prim's script is changed (saved/reset) - at this point whilst the child prim sends the linked message, the root never recieves it - the root prim script still functions correctly in all other aspects - I have to reset the root prim script before it starts receiving the link messages again! I have no idea why this is happening!

I have attached the scripts =) Huge thanks in advance for any help here!
Laronzo Fitzgerald
Registered User
Join date: 20 Apr 2007
Posts: 6
Bug
08-10-2008 23:43
This seems to be an "undocumented feature".. =P

A bug report was filed by my colleauge: https://jira.secondlife.com/browse/SVC-2780

As Harleen Gretzky points out:

"It is caused by the fact that saving the child prim script triggers a CHANGED_INVENTORY event in the root prim (actually any change to the child prim's inventory triggers this). Since nothing was dropped into the root your root prim script gets caught in an infinite loop in the changed event and hence can no longer respond to any other events.

Not sure if this is a bug or by design, I see no mention of it on the http://wiki.secondlife.com/wiki/Changed page, but on the old http://lslwiki.net/lslwiki/wakka.php?wakka=changed page it says CHANGED_INVENTORY is triggered "when inventory is changed in another prim in the linked object".

This behaviour is absolutely no use to anyone - most importantly we have noticed it doesn't just occur when recompilling child prim scripts, but also occassionally when we process messages via listen.

I've actually resolved the most crucial side effects of this by seperating the two elements of the script into two seperate scripts - thereby controlling any loops into the script which handles changed events.

I'm guessing the problem is still very relevant all the same though.
Kaluura Boa
Polygon Project
Join date: 27 Mar 2007
Posts: 194
08-11-2008 01:17
A fix would be welcome... But until that day, there is a very simple solution: Keep tracks of the number of items in inventory and let your script react only when that number actually changes. (This will also gives you the possibility to manage the removal of items.)

Just a little detail... I saw something really strange in your script:

if (change & CHANGED_ALLOWED_DROP || CHANGED_INVENTORY)

For me, that's the same thing than:

if ( (change & CHANGED_ALLOWED_DROP) != 0 || (CHANGED_INVENTORY != 0) )

That condition is always true. I think you meant:

if (change & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY))

It seems you don't like "else if"... Here is a line to replace your row of "if"'s.

string named = llList2String(["A Texture", "A Sound", "A Landmark", "An item of Clothing", "An Object", "A Notecard", "A Body part", "An Animation", "A Gesture", "Nothing"], llListFindList([0, 1, 3, 5, 6, 7, 13, 20, 21], [type]));

...And ((string)whatever_integer != "";) is always TRUE. Not very useful.

That's it. I quit grumbling that I wouldn't write your script the way you did. ;-)