Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
|
09-10-2004 01:45
I created an object that was to pick a random dance for my avatar to do and then change it every 60 seconds.
Works great when in use... but after stopping animation on my avatar via the script, whenever the object loops through the "change dance" cycle, it starts up my avatar again.
Here's how it's working:
There is a parent object which is sending a linked message of "randomize" to the "on" object every 60 seconds. When the "on" object gets this command it picks a random animation from it's inventory as the current dance.
I click on the "on", which requests permission to animate me. I say yes.
It starts me dancing whatever the current dance is.
When the "on" object receives the "randomize" command, it stops me dancing the first dance, picks a new random one, and then animates me with that new dance.
When I click on the "on" button a second time, it does an llStopAnimation on all of the dances in the list, just to make sure they are all covered (at first I was just llStopAnimation the current dance). When I do this, I completely stop dancing.
But as soon as it gets the randomize command again, I start dancing again, even after logging off, leaving the sim and coming back even.
I will PM the code to someone willing to help and familiar with animation. Thanks!
|
MSo Lambert
Registered User
Join date: 16 Aug 2004
Posts: 101
|
09-10-2004 02:25
There is currently no way to revoke permissions inside a script, but you can easily change your script to stop animating the avatar when you want. There are different ways to archieve this, but from the top of my head, you could do something like:
Have a bDoAnimate variable, set it to TRUE when you first touch the "on" object, set it to FALSE, when you touch it again. Then, only call llStartAnimation if bDoAnimate == TRUE.
Or, you could send a message to your parent object to stop sending messages every 60 seconds when you want your avatar to stop dancing.
_____________________
MSo
|
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
|
09-10-2004 03:16
Thanks MSo - When I saw in your post the "bDoAnimate == TRUE" I realized that I had made the same mistake I do ALLLL the time... using a single = when comparing rather than a double. Works perfect now. 
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
09-10-2004 23:43
silly q, but why use a Boolean value when you could use two states? one state could be inert waiting for the trigger command, and the other state could be proactive. Animating to the random trigger, and waiting for the end command.
The pre loop animation trigger could be on enter proactive state, and the clean up on exit proactive state.
|
MSo Lambert
Registered User
Join date: 16 Aug 2004
Posts: 101
|
09-11-2004 01:41
Its not a silly question, and using two states is probably the best way to make this kind of task... using a Boolean variable is just a quick and dirty replacement that works 
_____________________
MSo
|