Jump to content

Sitting on ground-


Perg0
 Share

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

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

Recommended Posts

Hello again fourm-

I have been working on my "bot" and was wondering if there is a LSL function or command to make an avatar sit on ground (Not on an object)?

 

Here is the current code i'm working with (also thanks to Rolig Loon for making the original script this is based off from.)

 

integer listen_handle;
integer channel = 0;


default
{
   
attach(key id)
    {
       
if (id)
        {
           
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
            listen_handle =
llListen(channel, "", NULL_KEY, "");
        }
    }

    run_time_permissions( integer perm )
    {
       
if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
           
llOwnerSay("Permissions has been granted automatically.");
        }
    }

    listen(integer channel, string name, key id, string message)
    {
       
if ( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION )
        {
           
if (llToLower(message) == "bot sit")
            {
               
llSay(0, "roger that.");
               
llSitTarget(<0,0,0>, ZERO_ROTATION); //This is the function i want to make it sit
            }
        }
    }
}

Thanks again you guys, I have gotten a real bite into this LSL stuff after a while! :D

~Perg0

Link to comment
Share on other sites

If you are scripting in an Experience, you can use the llSitOnLink function to force an avatar to sit on a specific object.  You'd usually use that in conjunction with the SLPPF parameters PRIM_ALLOW_UNSIT and PRIM_SCRIPTED_SIT_ONLY, to customize the environment.  The llSitOnLink function is meant to go into the object that you want someone to sit on, however, so it's not likely to be useful directly in a scripted object attached to your bot.  If that's what you are trying to do, I think you'll need to have the bot send a chat message to a scripted seat, triggering its script to seat your bot. 

  • Like 1
Link to comment
Share on other sites

You can make your bot play a ground sit animation in the usual way with llStartAnimation.

I was about to say you can use the built-in default animation, but looking at the wiki page for the internal animations, http://wiki.secondlife.com/wiki/Internal_Animations, I see there's two: "sit_ground" and "sit_ground_constrained", and I'm not sure what the difference is. My first guess is that the constrained version locks the avtar in place so it can't get bumped around, as with an actual ground sit. But that's just a guess.

If your bot is using an AO with a ground sit animation of its own, you can also try using that.

Anyhow, try llStartAnimation ("sit_ground") or llStartAnimation ("sit_ground_constrained"), or even llStartAnimation ("My AO groundsit animation") and see how that goes. Note that neither of the two built in animations have to be in the inventory of the object triggering them, but a custom animation of your own does. And if your bot's AO is using a set of stand animations that cycle, this will likely mess up its ground sit animation.

  • Like 1
Link to comment
Share on other sites

17 hours ago, Rolig Loon said:

If you are scripting in an Experience, you can use the llSitOnLink function to force an avatar to sit on a specific object.  You'd usually use that in conjunction with the SLPPF parameters PRIM_ALLOW_UNSIT and PRIM_SCRIPTED_SIT_ONLY, to customize the environment.  The llSitOnLink function is meant to go into the object that you want someone to sit on, however, so it's not likely to be useful directly in a scripted object attached to your bot.  If that's what you are trying to do, I think you'll need to have the bot send a chat message to a scripted seat, triggering its script to seat your bot. 

Thanks for that :D i will give it a try tho i'm not sure if i understand this correct-

 

Are you saying i should create an object that i can attach to the bot which will make it sit or that i need to make an object it can sit on.

incase it's an object for it to sit on, that is not what im looking for. I need a function that uses the "Sit here" function you normaly have when you right click on you avi.

Link to comment
Share on other sites

You could do it either way.  I have a transparent attachment that automatically triggers a sit animation when I wear it.  It's very handy for taking photos in places where I might have a hard time sitting, or where the default sit target puts me in the wrong place. I wear the thins and can then move myself gently into position, apparently sitting on something else.

If you wanted your bot to sit on some specific predetermined things, though, you could take the other option.  Script the predetermined seats so that when you click on them (or send them some triggering signal), they use an Experience to force seat you. There are plenty of places in SL that do that now.

  • Like 1
Link to comment
Share on other sites

17 hours ago, KT Kingsley said:

You can make your bot play a ground sit animation in the usual way with llStartAnimation.

I was about to say you can use the built-in default animation, but looking at the wiki page for the internal animations, http://wiki.secondlife.com/wiki/Internal_Animations, I see there's two: "sit_ground" and "sit_ground_constrained", and I'm not sure what the difference is. My first guess is that the constrained version locks the avtar in place so it can't get bumped around, as with an actual ground sit. But that's just a guess.

If your bot is using an AO with a ground sit animation of its own, you can also try using that.

Anyhow, try llStartAnimation ("sit_ground") or llStartAnimation ("sit_ground_constrained"), or even llStartAnimation ("My AO groundsit animation") and see how that goes. Note that neither of the two built in animations have to be in the inventory of the object triggering them, but a custom animation of your own does. And if your bot's AO is using a set of stand animations that cycle, this will likely mess up its ground sit animation.

I have been looking around but could not find the "sit_ground_constrained" in my inventory- But maybe im looking the wrong place? ^^ also thanks for the help :D

Link to comment
Share on other sites

It's not in your inventory - it's one of SL's built-in animations, as is sit_ground and the others detailed on the wiki page I linked. You just have to use the name in llStartAnimation. It doesn't need to be in the object's inventory, it sort of "just exists" in Second life and is available to use in any script.

  • Like 1
Link to comment
Share on other sites

Oh thanks! I will give it a quick try and see if i can make it work- I will also try to post the finished code here with a few edits so that ppl might be able to use it later as refmaterial- (or maybe it should be in "LSL lib?")

Link to comment
Share on other sites

So it kinda works! :D

I can now make the bot sit by using the following:

(it's croped)

 listen(integer channel, string name, key id, string message)
    {
       
if ( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION )
        {
           
if (llToLower(message) == "bot sit")
            {
               
llSay(0, "roger, roger.");
               
llStopAnimation("");
               
llStartAnimation("sit_ground");
            }
           
if (llToLower(message) == "bot stand")
            {
               
llSay(0, "roger, roger.");
               
llStopAnimation("");
               
llStartAnimation("stand");
               
llResetAnimationOverride("");
            }
        }
    }

 

As you can see i have been having issus trying to make the bot stand again...

the llstopanimation and llresteanimationoverride dose not seam to make it stand back up. Any idears on how to make her stand? (i have also tried running the animation standup and Stand_1 ect...)

I will go and read up on the WIKI and post if i find a solution- Thanks for all the help again, You guys are the best! ^w^

Edited by Perg0
Wrong string text
Link to comment
Share on other sites

Using this version of the listen event seems to work:

    listen(integer channel, string name, key id, string message)
    {
        if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION )
        {
            if (llToLower(message) == "bot sit")
            {
                llSay(0, "roger, roger.");
//                llStopAnimation ("");
                llStartAnimation("sit_ground");
            }
            else if (llToLower(message) == "bot stand")
            {
                llSay(0, "roger, roger.");
                llStopAnimation("sit_ground");
                llStartAnimation("stand");
//                llResetAnimationOverride("");
            }
        }
    }


I've commented out the llStopAnimation and the llResetAnimationOverride functions that reference an empty string as they do nothing like that, but in the "bot stand" section I've changed the llStopAnimation call to specify the "sit_ground" animation that's started in the "bot sit" section.

As expected, my own AO messes up the ground sit when it cycles the stand animation to a different one (it doesn't know I'm supposed to look like I'm sitting on the ground, so it just carries on as if I was standing). So if your bot is using an AO, you may need to find a way to turn it off when your bot sits down. How to do that depends on what type of AO it's using.

(As an aside, and in answer to my own question about the differences between sit_ground and sit_ground_constrained, sit_ground works like any other animation, while the constrained version appears to disable the movement keys and bring up the stand button, though starting it using llStartAnimation does not seem to put my avatar into "Sitting on Ground" mode as reported by llGetAnimation.)

  • Thanks 1
Link to comment
Share on other sites

Wow that worked (both of you)

THANSK! now when i read it i can see the falut *face palm*. Guess i don't have such a good grip after all ^^'

 

Thanks again tho! you guys are the best :D

Link to comment
Share on other sites

This is what the script looks like now-

 

integer listen_handle;
integer channel = 0;


default
{
   
attach(key id)
    {
       
if (id)
        {
           
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
            listen_handle =
llListen(channel, "", NULL_KEY, "");
        }
    }

    run_time_permissions( integer perm )
    {
       
if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
           
llOwnerSay("Permissions has been granted automatically.");
        }
    }

    listen(integer channel, string name, key id, string message)
    {
       
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION )
        {
           
if (llToLower(message) == "Bot sit")
            {
               
llSay(0, "Roger, Roger");
                llStartAnimation("sit_ground");
            }
           
else if (llToLower(message) == "Bot stand")
            {
               
llSay(0, "Roger, Roger");
               
llStopAnimation("sit_ground");
               
llStartAnimation("stand");
            }
        }
    }
}

  • Like 1
Link to comment
Share on other sites

One thing that isn't going to work: if (llToLower(message) == "Bot sit"). "Bot sit" has a capital letter, so it will never be the same as a message that's been converted to all lower-case. Use "bot sit" instead. Ditto for "Bot stand".

And yeah, that's a thing with scripting: just when you think you've got something sussed, you run into something that lets you know there's even more to it than you thought.

  • Like 1
Link to comment
Share on other sites

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