Jump to content
SwireD

hide poseballs for two

Recommended Posts

hi! how to make a script for a linkset of two objects (poseballs) that will hide them only when both people sat on them?

Share this post


Link to post
Share on other sites
if (llAvatarOnLinkSitTarget(1) != NULL_KEY && llAvatarOnLinkSitTarget(2) != NULL_KEY) 
{
     llSetLinkAlpha(LINK_SET,0.0,ALL_SIDES)
}
else
{
     llSetLinkAlpha(LINK_SET,1.0,ALL_SIDES)
}

assuming that you have defined llLinkSitTarget for both poseballs.

  • Thanks 1

Share this post


Link to post
Share on other sites
54 minutes ago, Rolig Loon said:

if (llAvatarOnLinkSitTarget(1) != NULL_KEY && llAvatarOnLinkSitTarget(2) != NULL_KEY) 
{
     llSetLinkAlpha(LINK_SET,0.0,ALL_SIDES)
}
else
{
     llSetLinkAlpha(LINK_SET,1.0,ALL_SIDES)
}

assuming that you have defined llLinkSitTarget for both poseballs.

Thank you! I forgot to mention that I do not need the animation itself in this script, it will be a separate scripts AVsitter2. Does this change anything? and I could not find anything about llLinkSitTarget in web. can I have some kind of example please?

Share this post


Link to post
Share on other sites

I found your script on the forum and inserted what you provided. but for some reason it doesn’t work.

default
{
    state_entry()
    {
        llSetMemoryLimit(0x4000);
        llLinkSitTarget(1, < -0.5, 0.32, 0.1 > , llEuler2Rot( < 0.0, 0.0, PI / 2 > )); // Sit on the "seat" prim
        llLinkSitTarget(2, < 0.2, 0.35, 0.4 > , llEuler2Rot( < 0.0, 0.0, PI / 2 > )); //Sit on the "leg" prim

        if (llAvatarOnLinkSitTarget(1) != NULL_KEY && llAvatarOnLinkSitTarget(2) != NULL_KEY)
        {
            llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
        }
        else
        {
            llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
        }
    }
}

 

Share this post


Link to post
Share on other sites

Your reference for any LSL functions is always the LSL wiki.  In this case, look at http://wiki.secondlife.com/wiki/LlAvatarOnLinkSitTarget and related functions.  Study the examples for that function to get an idea of how it might be used.  Also, when you are about to use an unfamiliar function, take a look through any Caveats to see what limitations there my be on its use.

For something as simple as a couple of linked poseballs, I would not recommend using AvSitter.  Just write your own script and include any animation code in it.  I certainly would avoid trying to combine AvSitter with another script in the poseballs.  You're likely to get all sorts of conflicts between them.

  • Thanks 1

Share this post


Link to post
Share on other sites
5 minutes ago, SwireD said:

I found your script on the forum and inserted what you provided. but for some reason it doesn’t work.

Bits of code in this forum are very rarely complete scripts.  This is a forum for scripters to trade ideas and curse at the things that go wrong in our scripts, so we tend to post snippets of code as illustrations or as puzzles.  In this case, you should be expecting to detect when both avatars are sitting by watching for the execution of a changed event, not in the state_entry event, which is only executed when the script is reset.

  • Thanks 1

Share this post


Link to post
Share on other sites
Posted (edited)
29 minutes ago, Rolig Loon said:

Bits of code in this forum are very rarely complete scripts.  This is a forum for scripters to trade ideas and curse at the things that go wrong in our scripts, so we tend to post snippets of code as illustrations or as puzzles.  In this case, you should be expecting to detect when both avatars are sitting by watching for the execution of a changed event, not in the state_entry event, which is only executed when the script is reset.

Thank you so much! I managed to make it work, added changed event. However, I have not tested it yet with the AVsitter.

default
{
    state_entry()
    {
        llSetMemoryLimit(0x4000);
        llLinkSitTarget(1, <0.0,0.0,0.5>, ZERO_ROTATION);
        llLinkSitTarget(2, <0.0,0.0,0.1>, ZERO_ROTATION);
    }

    changed(integer change)
    {
        if (llAvatarOnLinkSitTarget(1) != NULL_KEY && llAvatarOnLinkSitTarget(2) != NULL_KEY)
        {
            llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
        }
        else
        {
            llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
        }
    }
}

 

Edited by SwireD

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...