|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-28-2007 23:32
How would i got about using llGetAnimation to detect a certain anim playing? I really just want to look for one anim rather then a whole list of anims that are going on with the av like you would with llGetAnimationList. I was reading and it said that llGetAnimation "Returns the current basic animation state for avatar id.". How would i go about this to change the defalut sl crouching walk with a custom one? lol, I really didn't understand the wiki page about it. I'm guessing when blah state happens then i can stop the anim for it and use custom but would that mess up the state? lol, I'm confused. 
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
Lol, an answer
06-28-2007 23:47
From: Alicia Mounier How would i go about this to change the defalut sl crouching walk with a custom one? lol, Periodically check if llGetAnimation returns "CrouchWalking". lol, If so play your custom animation. lol, when llGetAnimation no longer returns "CrouchWalking", stop your custom animation. lol
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-29-2007 00:13
Hey I didn't say lol that much, lol. Ok I'll look into it more but I'm still not sure how I would go about do it. Is it something like, if (llGetAnitmation() == CrouchWalking) or does it return a number?
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
06-29-2007 00:24
It returns a string, so you want "CrouchWalking" in double quotes.
|
|
Alicia Mounier
Registered User
Join date: 17 Oct 2005
Posts: 78
|
06-29-2007 00:42
Cool. Ok, thanks. I'll try it out. **EDIT** Sweet it works, this should free up some mem on the script also. Thanks again for the help! 
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-29-2007 02:07
By the way, back on some related thread, I mumbled something about the relative speeds of llGetAnimation() vs llGetAgentInfo(). When I was reminded (thanks!) that the string return value of llGetAnimation was gonna require a string compare vs a bitfield test for llGetAgentInfo, Qie's shaggy lil head got a thumpin'. But since I was reminded I wanted to run some other LSL timing tests, I went ahead and started testing these differences.
Surprisingly, string compare doesn't seem to be all that expensive--though of course the bitwise comparisons win. The exact results depend on where character differences occur in the string, and how many string compares you have to do in switch-style if/else blocks, etc., but for AO purposes the differences seem pretty negligible, assuming the order of the conditionals reflects the frequency of occurrence.
But before I got around to exhaustive testing of factors that might affect that result, I was totally distracted by a very strange and robust result that I can't explain at all: If llGetAgentInfo() is called and nothing is done with the result (not even part of an assignment statement) *and* the object containing the script is not attached, it is very slow... at least 6 times as slow as llGetAnimation() under the same conditions. However, if the object is attached and/or the result is used in a simple assignment statement, this difference goes away, and both calls are about the same speed as llGetAnimation is under the anomalous condition.
Ummm... "go figure."
|