Jump to content

Script not seeing unsits


QuietWren
 Share

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

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

Recommended Posts

I'm making a script to add to existing chairs. It's supposed to note when a person sits on or unsits from the chair it's in, but for some reason it's only seeing the sit. Here is the snippet that is supposed to see the change:

    changed(integer change)
    {
        if (change == CHANGED_LINK)
        {
            llOwnerSay("The number of links has changed");
            kSitter = llAvatarOnSitTarget();
            if (kSitter == NULL_KEY)
            {
                llOwnerSay("Stand");
                onStand();
            }
            else
            {
                llOwnerSay("Sit");
                onSit();
            }
        }
    }

This works correctly for sits, firing the correct OwnerSays, but on standing up from the chair it's silent. Could this be blocked from change events by other scripts in the chair?

Link to comment
Share on other sites

You can always test to see whether a person is sitting on the chair by asking

if ( llGetAgentSize( llGetLinkKey( llGetNumberOfPrims() ) ) == ZERO_VECTOR )

Try that and see what happens.  Meanwhile, don't write

if (change == CHANGED_LINK)

You should be testing by doing bitwise masking of change with CHANGED_LINK:

if (change & CHANGED_LINK)

 

  • Like 2
Link to comment
Share on other sites

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