Jump to content

MessageLinked with specific link numbers


Impresario Beaumont
 Share

You are about to reply to a thread that has been inactive for 131 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have an object comprised of a large number of prims. I thought it would be more efficient to communicate with MessageLinked to each specific prim by using that prim's link number, rather than using LINK_SET and having each prim determine if the message was meant for it by filtering on the data being sent. Alas, that didn't work for me.

So I created a simple linked object of three boxes, resulting in link numbers 1, 2 and 3. In the root prim (link number 1) I placed a script that send one message to link 2 and a different message to link 3. In each of the other two prims (link # 2 and 3) I created a script that printed the message it received.

What happened is that the link 2 prim printed the prim 3 message and prim 3 printed the prim 2 message. I verified that each prim had the correct link number. 

To complicate matters further, when I added a fourth box, the second box got the fourth box's message, the fourth box got the second box's message. The third box got the correct message. I continued to add boxes and they all seem to confuse the link number for their prim with someone elses.

Any thoughts?

 

Root script:

default
{
    touch_start(integer total_number)
    {
        llMessageLinked(2, 0, "Second guy", "");
        llMessageLinked(3, 0, "Third guy", "");
        llMessageLinked(4, 0, "Fourth guy", "");  
        llMessageLinked(5, 0, "Fifth guy", "");  
    }
}
Prim with link # 2:

default
{
    link_message(integer source, integer code, string data, key ID)
    {
        llSay(0, " link 2 received: " + data);
    }
}
 

The other scripts merely change the llSay message to define the correct prim

 

Link to comment
Share on other sites

58 minutes ago, Impresario Beaumont said:

I verified that each prim had the correct link number. 

When you link prims, for the first time, pretty much all viewers have a bug where they misunderstand which links have which number. The standard fix for this bug is to take the object back into your inventory, and then rez it again. (If anyone feels like expiramenting, does re-logging or teleporting to a different region for a few minutes and then teleporting back fix the displayed numbers?)

IIRC, If you have an object with links named 1,2,3,4 and link it to an object with links named a,b,c,d the links will be ordered a,1,2,3,4,b,c,d, but your viewer will wrongly tell you they're in the order a,b,c,d,1,2,3,4 unless you do the take and re-rez trick.

Edited by Quistess Alpha
  • Thanks 1
Link to comment
Share on other sites

Unfortunately, the viewer isn't told about link numbers. The messages from simulator to viewer don't have link numbers. The viewer just numbers them in the order it is told about them. Viewer side link numbers tend to agree with the simulator side link numbers, but there is no guarantee. The viewer doesn't need link numbers; it has a totally different system for identifying child prims and their parents.

Name your child prims. The viewer and simulator both have good info about names. This is mostly a problem when all the child prims are named "Object". See this old article about how to look up by name in a script.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 131 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...