can't stop animation error
|
|
Yamil Dagger
Registered User
Join date: 10 Jul 2007
Posts: 36
|
04-28-2008 11:00
Hey guys, I got me a problem that seems like it would have an easy fix but I can't figure it out. I have some pretty good camping scripts i'm trying to make sure are as bug free as possible. Right now one of the scripts is for applying an animation upon sitting. I noticed that if somebody logs out while still sitting, the animation script pops up an error saying it can't stop the animation.
I've looked at alot of other freebie animation scripts and I am not doing anything different then them... What can I do to prevent this error?
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
04-28-2008 11:48
Post an example of what you're comparing with. In general, don't start or stop an animation unless (llKey2Name(llAvatarOnSitTarget()) != ""  If this expression is false (that is, if llKey2Name returns ""  , then either nobody is on the sit target, or they're no longer nearby. I use this to avoid a lot of those errors.
|
|
Yamil Dagger
Registered User
Join date: 10 Jul 2007
Posts: 36
|
04-28-2008 11:54
right but when the person stands up, you need to stop the animation on them and there is nobody sitting on it anymore... thats my problem. If they stand up, thats fine but if they log out, it can't stop their animation, hence the error.
|
|
Xhawkx Holden
Registered User
Join date: 1 Nov 2006
Posts: 86
|
04-28-2008 11:57
when they stand up.. check if they are still near by.. if so.. then stop the animation... if not.. assume they logged out (or TP'd away from the sitting position)
|
|
Ravanne Sullivan
Pole Dancer Extraordinair
Join date: 10 Dec 2005
Posts: 674
|
04-28-2008 12:24
you want an if statement similar to this before you try to start or stop an animation.
if((llGetPermissions() && PERMISSION_TRIGGER_ANIMATION) { (start or stop animation code) }
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
04-28-2008 12:49
From: Ravanne Sullivan you want an if statement similar to this before you try to start or stop an animation.
if((llGetPermissions() && PERMISSION_TRIGGER_ANIMATION) { (start or stop animation code) } I think you'll want to use a single ampersand there (bitwise AND rather than logical AND), and possibly also check the value of llGetPermissionsKey(). I'm not sure how those are affected by a logout though.... 
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
04-28-2008 13:01
Actually, you don't need to stop an animation when someone stands. Older scripts all do this, but LL changed things so that it's no longer necessary. At least, that's what I find. YMMV 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
04-28-2008 13:17
From: Lear Cale Older scripts all do this, but LL changed things so that it's no longer necessary. At least, that's what I find. YMMV  Could be, but note also dance machines and such, where the avatar isn't sitting. While many might stop animations based on an active event like a touch, some might also want to stop the animation if the avatar is no longer in an active area. I wonder how careful LL is to have the logic remember how the permissions were obtained. I can't say I trust it very highly.
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
04-29-2008 05:15
From: Hewee Zetkin Could be, but note also dance machines and such, where the avatar isn't sitting. While many might stop animations based on an active event like a touch, some might also want to stop the animation if the avatar is no longer in an active area. I wonder how careful LL is to have the logic remember how the permissions were obtained. I can't say I trust it very highly. Correct, but we're talking about a sat-upon object in this thread. Furthermore, I find that SL is more robust about stopping the animationon "stand up", without script errors, than the poseball and similar scripts that I find in SL. In all scripts where I've removed the "stop animation on stand", I haven't ever seen a case where it failed. It's just unnecessary complexity (now). Of course, the SL client, along with client/server interactions, isn't terribly robust about animations. When running two clients, I occasionally see very different results looking at the same avatar. But this is a completely different area than the one I mentioned above, because no scripting could possibly correct it without doing silly things like starting an animation multiple times (and no guarantee that this would even help).
|
|
Yamil Dagger
Registered User
Join date: 10 Jul 2007
Posts: 36
|
05-07-2008 13:40
Ok NONE of the above posts probed to be correct... SL does NOT stop animations upon standing up, I tested it and the animation just continues going. The get permissions thing does NOT prevent the error if somebody logs out for TPs away either...
So would a sensor be the only way to know if you should stop the animation or not?
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
05-07-2008 17:02
The implicit animation stop on stand seems to rely on a message coming from newer viewers. Avatars logged in through older LL-based clients and libsl ones still need to have the animations explicitly stopped by LSL, and with the realities of network hiccups it might not be a bad idea to leave it there for the new ones too. For the annoying error messages, something like this will eliminate most: // lastsitter was the last non-null llAvatarOnSitTarget result
if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) { if (llGetObjectDetails(lastsitter, [OBJECT_POS]) != []) { llStopAnimation(sitanim); } }
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
05-08-2008 05:59
From: Yamil Dagger Ok NONE of the above posts probed to be correct... SL does NOT stop animations upon standing up, I tested it and the animation just continues going. The get permissions thing does NOT prevent the error if somebody logs out for TPs away either...
So would a sensor be the only way to know if you should stop the animation or not? OK, thanks for the correction; I'll retest this myself. Sorry for misleading! For sat-upon objects, check the av's key against llAvatarOnSitTarget() rather than llGetPermissionsKey(). If someone crashes or logs off while sitting, llAvatarOnSitTarget() will return NULL_KEY.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-08-2008 09:39
From: Lear Cale For sat-upon objects, check the av's key against llAvatarOnSitTarget() rather than llGetPermissionsKey(). If someone crashes or logs off while sitting, llAvatarOnSitTarget() will return NULL_KEY. If someone just stood up, llAvatarOnSitTarget() will also return NULL_KEY, and that is exactly the case that we are talking about, I believe. I think the above approach of testing whether the previous sitter is still in the sim using something like llGetObjectDetails() is a good one, but other functions might be played with as well, such as llGetAgentSize().
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
05-08-2008 12:16
From: Hewee Zetkin If someone just stood up, llAvatarOnSitTarget() will also return NULL_KEY, and that is exactly the case that we are talking about, I believe. I think the above approach of testing whether the previous sitter is still in the sim using something like llGetObjectDetails() is a good one, but other functions might be played with as well, such as llGetAgentSize(). Oops, correct! thanks 
|
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
05-08-2008 21:49
llStopAnimation() requires that the avatar be in the sim. It used to be the case that when an avatar logged out while sitting the sim would unsit them first and then log them out. Scripts would be able to stop the animation within the change() event because of the delay in logging the avatar out of the sim. But recently the logout process changed and avatars log out of the sim before the script change() event handler is called.
What I do in my chairs, in addition to all of the permission checking and such, is to test whether llGetAgentInfo() returns zero. If it returns zero then the avatar is not in the sim and I skip the call to llStopAnimation(). Testing llGetAgentSize() for ZERO_VECTOR should also work.
|
|
Yamil Dagger
Registered User
Join date: 10 Jul 2007
Posts: 36
|
05-09-2008 03:36
lol ok people think about it!. When standing up you can't use llAvatarOnSitTarget() to sell the script to stop the animation or not because obviously you'd want to stop the animation if llAvatarOnSitTarget() IS a null value. That doesn't tell you if he tped away or logged out which is my original problem...
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
05-09-2008 04:10
From: Yamil Dagger lol ok people think about it!. When standing up you can't use llAvatarOnSitTarget() to sell the script to stop the animation or not because obviously you'd want to stop the animation if llAvatarOnSitTarget() IS a null value. That doesn't tell you if he tped away or logged out which is my original problem... Right, that is what the llGetObjectDetails is there to take care of. If it returns [] then the avatar has gone away, so animation stopping can be skipped. What you need to do is store away the avatar's key when it first sits down, so that you can use it after to do that check. For campers you are presumably already doing that so you know who to pay.
|