Jump to content
  • 0

activation on sitting


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

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

Question

I have a script that creates a particle when i am standing still. I also want it to create a particle when I am sitting. I have added the following animations: string anim = llGetAnimation(llGetOwner());
if ((anim == "Standing") || (anim == "sit") || (anim == "groundsit") || (anim == "sitting")) .  The standing animation works fine, but nothing happens on sit. when i walk, the particals stop. when i stand still, the particle starts, when i sit, nothing happens.

Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

i have looked at those and have tried the sitting animation. It didnt work. What did work as a test, was to run a random animation like a dance, and insert that into the script, and that worked just fine, so all i need is the correct name for the sit state animation

!

Link to post
Share on other sites
  • 0

Tiggy, assuming the script is in a HUD/attachment then a way to do this is to poll llGetAgentInfo in a timer

http://wiki.secondlife.com/wiki/LlGetAgentInfo

example pcode

 

default
{
   state_entry()
   {
      llSetTimerEvent(1.0); // 1.0 = poll once a second, change to whichever
   }

   timer()
   {
      integer info = llGetAgentInfo(llGetOwner());
       
      if (info & (AGENT_ON_OBJECT | AGENT_SITTING))
      {   
           // avatar is sitting on a object or sitting on the ground
                    
           ... stop standing particles ...
           ... play sitting particles ...
      }
      else
      {
         ... stop sitting particles ...
       
         if (info & (AGENT_FLYING | AGENT_IN_AIR | AGENT_WALKING))
         {
            // avatar is moving in some way
          
            ... stop standing particles ...
         }
         else
         {
            // avatar is not moving
               
            ... start standing particles ...
         }
      }
   }
}

 

Link to post
Share on other sites
  • 0
16 hours ago, Tiggy3 said:

i have looked at those and have tried the sitting animation. It didnt work. What did work as a test, was to run a random animation like a dance, and insert that into the script, and that worked just fine, so all i need is the correct name for the sit state animation

!

If you do continue with llGetAnimation, please do take a look at the wiki page I linked. There you'll see that the strings the function returns for the sitting states are "Sitting" and "Sitting on Ground" (and it's important to use the same capital letters – "Sitting" is not the same as "sitting").

Something that might be causing confusion is that llGetAnimation does not return the name of an animation that's playing, it returns the state the avatar is  in. So if your avatar is sat on something, llGetAnimation will return "Sitting" whatever animation your AO, or the object you're sitting on, has started.

  • Like 1
Link to post
Share on other sites
  • 0

Sorry this reply took so long! you were correct about the capital letters in "Sitting on Ground", I had missed one letter. Thanks, works great now.

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 112 days.

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

Join the conversation

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

Guest
Answer this question...

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