Jump to content
Naskiff

Weird sensor detect/no detect loop [Solved]

Recommended Posts

integer sensorDetected = 0;
default
{
    state_entry()
    {
        llSensorRepeat("","",AGENT,35,PI,3.0);
    }
    sensor(integer detected)
    {
        if (sensorDetected == 0)
        {
            sensorDetected = 1;
            llOwnerSay("Someone is nearby.");
        }
    }
    no_sensor()
    {
        if (sensorDetected == 1)
        {
            sensorDetected = 0;
            llOwnerSay("Nobody is nearby.");
        }
    }
}

This script, when worn, should tell me only once whether there is someone nearby or not, until there is a change in whether there is someone or not.

This script works everywhere I have been, except at my friend's home on the main land. If I stand there without moving and nobody else is around, every 3 seconds I receive one of the two messages.

Nobody is nearby.
Someone is nearby.
Nobody is nearby.
Someone is nearby.
Nobody is nearby.
Someone is nearby.
...

I thought maybe it comes from a nearby item even though it's scanning for agents...  so I went a few meters high in the sky where the nearest item is hundreds of metres away, and I still get the message spam, so it's about X Y and not Z positioning.
If I walk to the neighboring parcels far enough, it doesn't spam anymore.
If someone else is there, it works fine.
If I TP out, it works fine in that other sim... As soon as I TP back and there is nobody there, it spams the messages again.

I tried PI/2. When someone is nearby and I face them, they are detected once. If I don't face them, they are not detected, again once. That's working as intended. But I need a 360° scan.
Doing PI/1 doesn't change anything, it behaves in the same spammy way.

The parcel's "options" are 100% health, avatars inside this parcel cannot be seen, Health, no flying, no voice.

The spam happens to whoever wears this script in that zone.

I have another object there that scans the region occasionally, so I rezzed it in another place to see if causes the spam. It does not.

Any ideas? I realize it's not exactly a scripting question, but I don't know a better place to ask.

 

Edit: I have changed it to llInstantMessage to rez it at the home and TP away. It never spams, it works as intended. So the weird loop happens when I'm wearing it and there is nobody else around and I'm at this specific home.

Edited by Naskiff

Share this post


Link to post
Share on other sites

Here's an interesting note in the LSL wiki:

llSensorRepeat can occasionally detect outside of it's specified range every few cycles when used near sim borders. llSensor in a timer does not.

I don't recall ever having this trouble with llSensorRepeat, but I can't say that I have spent much time testing near a region boundary either.  You might try replacing it with a timer that triggers llSensor and see if that makes a difference.

  • Like 1

Share this post


Link to post
Share on other sites

Wow...  you're good!  It was exactly that.  It's indeed next to the sim border, and using a timer for llSensor fixed it. I tested in a populated sim, and then back to the home, and it works as I needed it to. Thank you!

Edited by Naskiff
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...