Ricky Shaftoe
Owner, "Rickymations"
Join date: 27 May 2005
Posts: 366
|
08-27-2005 14:39
I've been making my own poseball, using the poseball tutorial in the Wiki. But that code doesn't get me past the permissions check. I've tried variations, and still no love. Here's my current code (in the changed event and run_time_permission). Can someone give me some guidance? I know I could just copy someone else's script, but I want to understand what I'm doing wrong. changed (integer change) { if (change && CHANGED_LINK) { key avatar = llAvatarOnSitTarget(); if (avatar != NULL_KEY) { llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); llStopAnimation("sit"  ; llStartAnimation("my animation"  ; } else { llStopAnimation("my animation"  ; } } } run_time_permissions(integer perm) { if (perm) { llStopAnimation("sit"  ; llStartAnimation("my animation"  ; } }
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-27-2005 15:18
Here ya go. I think I've got this commented well enough to explain the changes. key av; // to store if we currently hav an avatar on this prim default { changed (integer change) { if (change & CHANGED_LINK) // single ampersand here to check only for CHANGED_LINK and ignore other changes { key avatar = llAvatarOnSitTarget(); if (avatar != NULL_KEY && av == NULL_KEY) // this means we have a new sit { av = avatar; // store the key, we've got a sitter. llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); // Request permissions (will be auto-granted) } else if ( avatar == NULL_KEY && av != NULL_KEY ) // We had someone, they stood { if ( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION )llStopAnimation("my animation"); llResetScript(); // Tidy cleanup } } } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) // If we just got anim permissions { llStopAnimation("sit"); // make them animate! llStartAnimation("my animation"); } } }
|
Ricky Shaftoe
Owner, "Rickymations"
Join date: 27 May 2005
Posts: 366
|
08-27-2005 18:13
Woot! That's just what I was looking for, and more! Thanks so much, Jillian. Off to play with it now.
I have to say I've had fun scripting so far, even if I'm just reinventing a lot of wheels.
|
Ricky Shaftoe
Owner, "Rickymations"
Join date: 27 May 2005
Posts: 366
|
08-27-2005 19:13
Well, it's still not working. I put in "llSay" lines to see where I'm failing, and it appears that I don't pass the first test. When I get to this code: key avatar = llAvatarOnSitTarget(); llSay(0, "OK, avi is sitting"  ; if (avatar != NULL_KEY && av == NULL_KEY) { av = avatar; // store the key, we've got a sitter. llSay(0, "Requesting permissions"  ; llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); I see "OK Avi is sitting," but I never see "Requesting permissions." Could it be that AvatarOnSitTarget is returning NULL_KEY when I sit on it for some reason?
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-27-2005 19:47
You know, I never did check to see if you were making a sit target. llSitTarget() The prim needs one for the script to work. It looks like you don't have one, and so llAvatarOnSitTarget is returning a NULL_KEY.
|
Ricky Shaftoe
Owner, "Rickymations"
Join date: 27 May 2005
Posts: 366
|
08-28-2005 09:59
I actually was calling llSitTarget (I didn't repeat that code here), but apparently you can't give that function only zero parameters or indeed AvatarOnSitTarget will return NULL_KEY. So now it works! Woot.
Now to start thinking about how to synchronize related animations on two balls. I've peek at the threads I've seen on this again...
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
08-28-2005 11:58
llSitOnTarget() with all zeros removes the target, the only way to do so. It's odd, but that's why it's there.
|