You are currently in the Forum Archive. All content within this area is Read-Only and cannot be modified. Active Forums can be found here.
Reply
Honored Resident
Life Camino
Posts: 63

How do I send a message from one object and receive it in another object?

I've got one script that sends a linked message over to a communication script that uses llSay() to chat a string message that I then want to receive by another object and then have that object say the message.  I've got the linked message part working, and the communication script seems to be working properly in the sending object.  When I have it chat the string on channel 0 the proper string is displayed in local chat.  But, I can't seem to get the remote object to hear the chatted string.  Here are the two scripts I am using to do this:

Communications script (from the sending object):

integer channel = -20;

default {

link_message(integer sender_num, integer num, string msg, key id) {
    llSay(channel,msg);
    }
}

Client listener script (in the receiving object):

integer channel = -20;

default
{   
   
listen(integer channel, string name, key id, string msg )
   {      
       llListen(channel,"","", msg);
       llSay(0,msg); 
    }
}

What am I doing wrong here?  Please, pardon my ignorance.  I'm still very new to LSL.  Any help would be greatly appreciated.

Member
Holy Gavenkrantz
Posts: 168

Re: How do I send a message from one object and receive it in another object?

Reply to Life Camino - view message

integer listen_channel = -20;

default
{

state_entry()

{

llListen(listen_channel,"","","");


   
listen(integer channel, string name, key id, string msg )
{  

     if ( channel == listen_channel )   
           llSay(0,msg); 
}
}

close!

you just had to enable the listen event outside of the event itself. You could also further filter the llListen function by putting in the sending prims name or key. Also you have integer channel used twice the script may function but sooner or later you will run into errors

If rotations were easy everything would be spinning
Honored Resident
Life Camino
Posts: 63

Re: How do I send a message from one object and receive it in another object?

Reply to Life Camino - view message

I think I understand what I did wrong, now.

Thank you so much!  That was exactly the help I needed!