How do I get this to work?
list aoAnimState = [];
default
{
state_entry()
{
aoAnimState = llGetAnimationList(llGetOwner());
if (aoAnimState = TRUE)
{
llOwnerSay("something"
;}
}
}
These forums are CLOSED. Please visit the new forums HERE
||GetAnimationList |
|
|
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
|
11-05-2007 18:34
I'm new to dealing with lists. I want to detect if an avatar is running an animation (any animation). If that AO state is true then an event occurs.
How do I get this to work? list aoAnimState = []; default { state_entry() { aoAnimState = llGetAnimationList(llGetOwner()); if (aoAnimState = TRUE) { llOwnerSay("something" ;} } } |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-05-2007 18:51
/54/10/142477/1.html
contains a script that shows what needs to be done. You need to get more then just one animation. At times there may be more then one running, populate a list as shown. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
11-05-2007 19:41
I want to detect if an avatar is running an animation (any animation). If that AO state is true then an event occurs. |
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
11-06-2007 05:50
Hello Keera
![]() aoAnimState = llGetAnimationList(llGetOwner()); ...returns a list of keys, so... if (aoAnimState = TRUE) ...is unlikely to cut the mustard (even besides the obeservation that it would more properly be '=='). This will tell you what's in the list: for (x = 0; x < llGetListLength(aoAnimState); ++x) { lOwnerSay(llList2Key(aoAnimState, x)); } ...although I'm not quite sure how this will help you! Maybe this is what you had in mind: if (llGetListLength(aoAnimState) > 0) ...but as Qie said: "an avatar is almost always playing *some* animation" |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-06-2007 19:05
Keera sent me a note card in world and says she still needs help on this project.
Guess I should have simplified it more instead of sending her over to the pose ball script. This is what she has now: CODE
Told her we will bring it back here ot the forum. Told her it is the sum total of all of us here that makes the forum work. Each has different strengths and god only knows I have my blond moments I am not going to have much time tonight but am going to refactor it and strip out the global variable and see what I can come up with. Hopefully others will jump in here also and we can get her up and running. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-07-2007 14:00
Try this Keera, it matches the specs requested in your original post:
CODE
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
11-07-2007 15:12
I'm not quite sure of what the actual _goal_ here is.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!
http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-07-2007 15:38
I'm not quite sure of what the actual _goal_ here is. To keep from getting so bored that I am forced to go to Resident Answers to have something to read ![]() _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
|
11-07-2007 15:54
Thanks so much Jesse, and Pale.
I'm still not able to detect a running animation, though. If I run just one dance animation I still can't get any message from Owner. Maybe I'm being unrealistic here. For instance, are static poses also read as "animations"? I just want to single out *moving* animations, and there is probably no way I can do that either.... |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-07-2007 16:08
Works fine for me. I just went into aditi and pasted that scripted into a box. WHen I touched it it said:
"[16:02] Object: avatar is running 3animation/s" So looks like it is time for more info. Are you trying to use this in an attachment, in an inworld prim, are you trying to populate the list from a touch event or detection or other? Changing to to populate the list in state entry would be like this: CODE
That one tested out in Aditi also. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
|
11-07-2007 19:30
Jesse you're right, it works for me when I put it in a new prim. Initially I put it in an attachment I had first detached, then rezzed in-world. That former attached prim refused to cooperate with the new script.
Sorry, I should have said that I want to use this in an attachment, and I want to populate the list from detection only. And I'm thinking now that I should limit this to dance animations only. Is it possible to use llGetInventoryName to get the name of the animation and target just those animations that contain the word "dance"? |
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
11-08-2007 13:36
The llGetInventory functions will only interact with the object's inventory, not the person's inventory, therefore the animation must have been run from the same object that is doing the checking and I don't think that's what you have in mind.
Sadly, llKey2Name (which can be used to convert a key to its name) only works with Objects and Avatars. I can think of no way you can universally tell what specific animation an Avatar is running except for its key. If your script recognises that key as one of its own object's inventory items then great, you've got access to its name. If not I don't see any practical way of knowing anything about the animation, except for its key. ![]() |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-08-2007 14:01
Pale is right, but you should be able to get the keys of your normal animations, from your AO for example. Sit, Stand, Fly, Hover etc and get those keys and put them in a list. Then check against that list and see if you are running an animation you don't normally run...............
Later I'll check and make sure the touch version I gave you would work as a hud attachemnt and change it to output the keys. You could then use them to populate your list. For example; just sit on something and then touch it to see which key is running. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
11-08-2007 14:11
One appropriate thing to mention might be that the function llGetAnimation does not return the same things as llGetAnimationList. It returns a "basic animation state" as a descriptive string. Admittedly it only ever returns one, but it doesn't require any sort of key lookup.
As well as that, if you are trying to detect actions or states it is best to ignore animations and look at other mechanisms. If you want to tell when somebody is moving, have an attachment take controls (but pass them through so that they still move) and use the control event. If you want to find out when they are flying, typing, jumping, use a timer that repeatedly polls llGetAgentInfo to determine such things. _____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!
http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-08-2007 14:30
And what Ordinal said brings up this question:
What is the end goal you are looking for beyond getting the animation? We might be able to point you in the right direction a little faster. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
|
11-08-2007 15:08
Wow, it's too bad you can't detect the names of animations. But I'm happy to hear about llKey2Name. And I understand so much more -- thanks everyone.
Well my end goal will probably sound silly but I make funky prim hats and I want the hat to move and do its thing whenever the avatar moves (particularly when dancing). The only thing I can't do at this time is detect what type of *non-default* animation is running. Maybe it is time for me to hang up my hat ![]() |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-08-2007 16:02
Wow, it's too bad you can't detect the names of animations. But I'm happy to hear about llKey2Name. And I understand so much more -- thanks everyone. Well my end goal will probably sound silly but I make funky prim hats and I want the hat to move and do its thing whenever the avatar moves (particularly when dancing). The only thing I can't do at this time is detect what type of *non-default* animation is running. Maybe it is time for me to hang up my hat ![]() Ahhhhhhh OK. Yep you would have to build soooo much into a system to try to get it to do what you want. Think in a case like this it is going to be much easier to just activate the hat by either touch or chat. _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
11-08-2007 16:52
...I want the hat to move and do its thing whenever the avatar moves (particularly when dancing). I must say, this is indeed Something New, to me anyway. One possibility might be to enlist the user's help a bit: if they'd be willing to touch the hat when they're animated with a particular dance to which the hat should respond, the script could do the llGetAnimationList thing and just remember the "top" animation (have to check which end of the list that is--the last one that got pushed on the avatar anyway), and then the next time that anim plays, the hat could detect it and do its thing. It could build up a list of these animations over time. (This does kind of remove the element of "surprise" that might have been intended, though.)One possibly useful tidbit: I think most people dance either standing (as from a dance machine or AO) or sitting (as on a dance poseball), so if the basic animation state isn't one of those, the script shouldn't need to llGetAnimationList and match the top anim with its list to decide whether to animate. (List operations are a bit expensive, so one might do well to avoid them when possible.) On the other hand... if the users decide they want their hats to dance while they're walking (and if wearing an AO, for a particular walk anim), I guess this approach could do that, too. |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-08-2007 17:13
Defintiely let me know when you have some up for sale. I've had this picture in my mind since you mentioned it of a dancing red & white Dr. Suess hat
![]() _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
|
11-08-2007 18:16
Great tidbits and suggestions, I will try them.
"Somebody has to Clean all this away. Somebody, SOMEBODY Has to, you see." ![]() |
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
11-09-2007 02:22
Just chiming in late in this conversation, what about the hat acting as the AO or including a modified ZHAO system or similar. Dropping an animation into the hat contents and selecting the dance you want from a menu. With a modified AO you could have it communicate that an animation has been started/stopped.
Long way round for a shortcut though. _____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum |