Jump to content

Strange listen script behavior.


Altier Verwood
 Share

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

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

Recommended Posts

Hello forums, I have two scripts that talk back and forth at each other, but I can't get the second script to work. 

Here is the message sent by the first script

This script works, it just shouts a region say when touched

        nameTag = llGetSubString(llGetObjectName(), 0, 6);
        llRegionSay(-83951,nameTag); 
        llOwnerSay(nameTag);      

in the second script, the get substring in the listen doesn't seem to work, if i remove that part the script works and it hears the region say. 

 state_entry()  
{
    llListen(-83951, "", "", "");   
    nameTag = llGetSubString(llGetObjectName(), 0, 6);
}
    listen(integer chn, string nam, key id, string msg)
    {
    if (chn == -83951 && llGetSubString(msg, 0, 6) == nameTag)

 

 

Link to comment
Share on other sites

It works for me using these scripts, where I've filled in some stuff needed for them to compile and run:

string nameTag;

default
{
    touch_start(integer total_number)
    {
        nameTag = llGetSubString(llGetObjectName(), 0, 6);
        llRegionSay(-83951,nameTag); 
        llOwnerSay(nameTag);
    }
}

and

string nameTag;

default
{
    state_entry()  
    {
        llListen(-83951, "", "", "");   
        nameTag = llGetSubString(llGetObjectName(), 0, 6);
    }
    
    listen(integer chn, string nam, key id, string msg)
    {
        llOwnerSay ("msg " + msg);
        if (chn == -83951 && llGetSubString(msg, 0, 6) == nameTag)
        {
            llOwnerSay ("!!!");
        }
    }
}

The only idea I have is that in your case the first seven characters of both object's names are not identical. (In my example both objects were called "Object".)

Edited by KT Kingsley
Link to comment
Share on other sites

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