Jump to content

Making a walkie talkie script but the names aren't showing correctly


Tyrannosaurus Alpha
 Share

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

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

Recommended Posts

default
{
    state_entry()
    {
        llListen(101, "", NULL_KEY, "");

    }

 listen( integer channel, string name, key id, string message )
    {
     
   key ownerid;
        string ownername;
       
               
        ownerid = llGetOwnerKey(id); // the the owner of the chatting objects
        ownername = llKey2Name(ownerid);
      
         llOwnerSay((string)ownername + " says: " + (string) message);
 llPlaySound("Walkie",1.0); 
    }

}

This is the script that deals with messages recived from other walkie talkies.

But for some reason It tells me the name of the other person

Link to comment
Share on other sites

I maybe can solve this! Its a great little script idea.

Here is what I think might be going wrong...

I think what you need to do is add an attach event, so the object detects when attached, and if new owner, resets the script.

Attachments cannot normally establish, or even notice they have a new owner, unless reset on attach. There is workarounds, but a reset is easiest to accomplish in your case.

Failure to detect new owner may be why it is giving the id of the other person (the original owner of the object I assume)

Hope that helps!

Link to comment
Share on other sites

both scripts are in the same prim

this is the script to send the message

default
{
    state_entry()
    {
 llListen(0, "", NULL_KEY, "");
    }

 listen( integer channel, string name, key id, string message )
    {
        llRegionSay(101,(string)message);
   
    }

 on_rez(integer start_param)
    {
      
        llResetScript();
    }

}
 

Link to comment
Share on other sites

it does - let me finish the story:

  1. A says something in open chat
  2. Both speakers hear it - you don't restrict the listener to the owner
  3. both speakers send the message spaker A to wt B and speaker B to wt A
  4. wt A says "B said" - because it received the message odf speaker B
    wt B says "A said" - because it received the message odf speaker A

TTry this

default{    state_entry()    { llListen(0, "", llGetOwner(), "");    } listen( integer channel, string name, key id, string message )    {        llRegionSay(101,(string)message);       } on_rez(integer start_param)    {              llResetScript();    }}

 



Link to comment
Share on other sites

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