Philip Revere
Registered User
Join date: 16 Jun 2005
Posts: 7
|
06-20-2005 19:18
I began work on a script that animates an avatar when they touch the object it is attached to. I'm using a list to hold all currently animated avatars, so that when they click it again, their animation is stopped and they are removed from the list.
I'm using llStopAnimation(ANIMATION_X); to stop animation for the last person that touched the object. However, a problem occurs when the following happens:
1) Person A clicks and accepts animator script 2) Person B clicks and accepts animator script 3) Person A clicks to stop animation
For some reason when Person A clicks to stop the animation, llStopAnimation() affects Person B instead, but Person A is still correctly removed from the list. I can't for the life of me figure out what I would use instead of llStopAnimation(), I looked high and low for a function like this that lets you specify the avatar to stop, but could find none.
It all depends on the order, the following works as expected:
1) Person A clicks and accepts animator script 2) Person B clicks and accepts animator script 3) Person B clicks to stop animation 4) Person A clicks to stop animation
If I follow a First-In-First-Out policy, it works fine. I believe this is some kind of undocumented behavior of llStopAnimation, because as I said before, the list objects are being added and removed correctly.
Anyone have any suggestions?
Also, I'm curious how I would syncronize the animations of all people that have clicked on the object, but that is less important as of now.
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
06-20-2005 19:46
This is the expected behavior of llStopAnimation. It stops the animation of the person it currently has permissions to animate for. A script can only have permissions to animate for one avatar at a time. When you call llRequestPermissions, and the request is accepted, the permissions the script has for any previous avatar are erased, and the new permissions are stored.
If you get permisisons from person B before stopping the animation, then you will be able to stop the animation for person B. Ensure that you have permissions from the target of our llStopAnimation call (using llGetPermissionsKey) before calling llStopAnimation. ==Chris
|
Philip Revere
Registered User
Join date: 16 Jun 2005
Posts: 7
|
06-20-2005 20:52
From: Christopher Omega Ensure that you have permissions from the target of our llStopAnimation call (using llGetPermissionsKey) before calling llStopAnimation.
I've modified the script so that directly before calling llStopAnimation, it calls another llRequestPermissions. I have a "permissions_action" state that holds whether the person was trying to start or stop animation, which is later referenced in run_time_permissions callback. Using this method, the avatar has to touch the object and accept the dialog to begin, and also must touch and accept the dialog to stop - but it DOES work! I've seen similar objects that don't require you to click "Yes" to stop the animation, how would I achieve this result?
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
06-21-2005 03:49
Most 1 prim dance machines, which do the job you're describing, hold multiple copies of the scripts, hence each script only accepts one permission.
Other dance machines, and there are quite a few of those around, have a prim per dancer, with one script per prim.
|
Philip Revere
Registered User
Join date: 16 Jun 2005
Posts: 7
|
06-21-2005 11:28
Is there any other function I could use that doesn't require user input that would change the avatar affected by llStopAnimation() ? I can even provide the key of the person touching the object and such (as that is detected correctly by llDetectedKey(0)).
This would resolve my problem about it prompting them to stop dancing, and wouldn't be a nasty hack like the other two methods you mentioned (multiple prims, multiple scripts)
|
Philip Revere
Registered User
Join date: 16 Jun 2005
Posts: 7
|
06-21-2005 15:29
Alright, straight from the mouth of a Linden, it's not possible to do what I'm wanting. I either have to prompt with a message again, or use separate scripts, as the scripting engine can only save a single runtime permission. This is pretty lame, but I guess I'll deal.
Anyone have any insite as to how they usually syncronize the animations on these things? Use a tick counter and only start the animation at a specific time? Is there a way to determine the current animation frame of another avatar and start there?
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
06-21-2005 16:26
User one script to organize an array of permission scripts. Permissions are a great idea, but it's current implication leaves some thing to be desired. Especially ones you start dealing with multiple avatars. I think one of the goals of the system is to prevent abuse. Witch is why scripts can't duplicate them self. Ug..
|