Jump to content

llMessageLinked question


Tattooshop
 Share

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

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

Recommended Posts

Hello! I am using this llMessageLinked for the first time and am not understanding something. I have two scripts ( "sender and listener"). It is not entirely clear what is 0 meant here. I have looked through many different examples and they use different meanings, numbers, words, is it a channel or what is it lol? :D

    touch_start(integer total_number)
    {
            llMessageLinked(LINK_SET, 0, "#start", "");
    }

 

Link to comment
Share on other sites

It's one of the three pieces of information you can send using llMessageLinked, and you can use it (or not) for whatever you want, the same as the string and the key parameters. It doesn't affect what the function does.

Incidentally, you can also use the key parameter to send another arbitrary string to the receiving script.

  • Thanks 1
Link to comment
Share on other sites

4 hours ago, Nova Convair said:

You transmit 3 parameters: an integer (0), a string (#start), a key

 

4 hours ago, KT Kingsley said:

It's one of the three pieces of information you can send using llMessageLinked

Many thanks! So, to simply send a command to play sound from the root prim to the child prim, it is enough to use 0?


And yet, one script used 0x5000, what could that mean?

Link to comment
Share on other sites

0 is fine. It's up to the receiving script to decide what, if anything, to do with the parameters it gets in the link_message event. The integer, string and key values you put into the llMessageLinked function are the values the script(s) in the specified link will get in their link_message event parameters.

If there's only one other script listening out for link messages and it has only one job to do, then none of the parameters really matter: just receiving a link message can be enough to let it know it should do its thing.

The integer parameter is often used to do things like identify a particular script that needs to respond to this link message, but not others, or to specify a particular request to do something specific with the data in the string or key parameters. The 0x5000 value you mention could be something like that.

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

28 minutes ago, Tattooshop said:

 

Many thanks! So, to simply send a command to play sound from the root prim to the child prim, it is enough to use 0?


And yet, one script used 0x5000, what could that mean?

look in the receiving script. It depends on the use case determined by the scripter

a use case could be that 0x5000 is a number like a postbox number to tell the receiving script that the message is for it.   Other scripts (in the build) could have their own postbox numbers. Something like:
 

link_message(integer sender_num, integer num, string str, key id)
{
   if (num == 0x5000) // the message is for me
   {
      ... do something with parameters: str and/or id

   }
}

in another script in the linked build, postbox number: 0x4000
 

link_message(integer sender_num, integer num, string str, key id)
{
   if (num == 0x4000) // this message is for me
   {
      ... do something with parameters: str and/or id

   }
   // else ignore messages that are not for me
   // like messages for postbox 0x5000
}

the postboxing method is often used when multiple scripts are in the same linked prim. Multi-player dance HUDs for example

 

edit add: What KT said

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

Adding to what KT and Molly have said, the receiving children also get an automatic parameter, the number of the child in the linkset that sent the message, so you can also have the listening children decide what to do based on the sender alone.

There is also an old (informal) protocol for using the message number as a general reset parameter, I have seen scripts where if this is -1 it signals to all the listening scripts that they are to reset or somehow go to a default initial state.

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1142 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...