Not understanding multiple permissions
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
08-11-2006 03:40
Hi, I am making an object that needs two sets of permissions: * Owner debit permission * Agent/user animation trigger permission I thought I understood how to divide those permission sets so I created two scripts and used llMessageLinked to communicate between the scripts. The main script requested owner debit permission and my idea was to have the linked script control animation because it would request and trigger animations from the Agent/user. I did that and I still get the error about the script not having PERMISSION_TRIGGER_ANIMATION permission even though it is able to trigger the animation. I don't have the code here to demo at the moment but it works something like this: * main script
state_entry { llRequestPermission(llGetOwner(), PERMISSION_DEBIT); }
run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) llSay(0,"Thank you - now I can take all of your money!"); else if (perm == 0) llSay(0,"I need permission to take all of your money so I can 'donate' it!"); }
changed(integer change) { if (! (change & CHANGED_LINK)) return; key id=llAvatarOnSitTarget();
if( id != NULL_KEY) llMessageLinked(LINK_THIS, 1, "", id); //trigger animation else llMessageLinked(LINK_THIS, 2, "", id); // stop animation
}
//other stuff here...
The linked script: //other stuff...
link_message(integer sender_num, integer num, string str, key id) { if(num == 1) llRequestPermission(id, PERMISSION_TRIGGER_ANIMATION); //request and trigger else if(num == 2) llStopAnimation("whatever"); }
run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) llStartAnimation("whatever"); else if (perm == 0) llSay(0,"I need permission to animate you!"); }
So all of this looks good and it works but I still get the PERMISSION_TRIGGER_ANIMATION error even though the animation triggers for the non-owner Agent/user. Have I misunderstood how this is supposed to work? Thanks -2fast
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
08-11-2006 03:48
From: 2fast4u Nabob Have I misunderstood how this is supposed to work? Yes.  Permissions granted are per script, not per object. So one script to handle money, and one script to handle animations. Don't mix them up.
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
08-11-2006 04:52
From: Angela Salome Yes.  Permissions granted are per script, not per object.. That is what I did..I have the main script requesting debit permission from the owner and another script requesting animation permission from the agent/user. The script that requests animation permission also triggers the animation. It works but I get the trigger animation error  Very strange.
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
08-11-2006 06:32
If you can't find another way around it, you use llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | PERMISSION_DEBIT); or suitable variations. You bitwise OR them together.
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
08-11-2006 06:46
From: Eloise Pasteur If you can't find another way around it, you use llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION | PERMISSION_DEBIT); or suitable variations. You bitwise OR them together. I understand that...the scenario I am working with is: * Need Debit permission for the script's owner * Need Animation permission for some other agent that sits on the object I don't have a problem getting permission for myself since I am the creator/owner. The problem occurs when I want to get animation permission from an agent that sits on the object. As I mentioned, I have two scripts - one that gets debit permission and another that gets the permission from the agent to animate. The problem is that even though I am able to animate the agent, I still get an error saying that the script does not have permission to animate  Refer to the sample scripts in the original post for details....I thought this was going to work but I suppose that I am missing something.
|
|
Moonshine Herbst
none
Join date: 19 Jun 2004
Posts: 483
|
08-11-2006 07:00
The script that does the animation must be the same script that got the permission.
|
|
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
|
08-11-2006 07:03
You need to to have a llSitTarget in order for "key id=llAvatarOnSitTarget();" to work. or it will always return a NULL_KEY. or does another script in that prim already have it?
Also when a person gets up from a chair. I don't think the chair has permission to animate or Stop animation from what I'm seeing in the linked script when num==2 at that point the person is nolonger linked to the chair.
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
08-11-2006 07:35
From: Gearsawe Stonecutter You need to to have a llSitTarget in order for "key id=llAvatarOnSitTarget();" to work. or it will always return a NULL_KEY. or does another script in that prim already have it? Yes..I already have that and it works. From: Gearsawe Stonecutter Also when a person gets up from a chair. I don't think the chair has permission to animate or Stop animation from what I'm seeing in the linked script when num==2 at that point the person is nolonger linked to the chair. Hmm....so you're saying that I again have to get permission to stop the animation? I did not think of that - I assumed that once the script had animation permission that it could start and stop animations as needed. I'll add a second permission reuquest - it's possible then that I am getting the error because I don't have permission to stop the animation. Intersting. I'll try it out later today and let you know. -2fast
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
08-11-2006 08:24
From: 2fast4u Nabob changed(integer change) { if (! (change & CHANGED_LINK)) return; key id=llAvatarOnSitTarget();
if( id != NULL_KEY) llMessageLinked(LINK_THIS, 1, "", id); //trigger animation else llMessageLinked(LINK_THIS, 2, "", id); // stop animation
} Think what happens when your AV stands up. ... that's right, your id becomes NULL_KEY, and you are then telling your animation script to stop animation for NULL_KEY (rather than for AV who was sitting on that spot) ... for which it obviously have no permission. One way to fix this would be to store key of sitting avatar in a global variable, then when you detect id == NULL which means avatar stood up, send this memorized key to your animation script so it knows who to stop the animation for. And yeah, doing a check for permission to animate (the if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) bit) also on stop animation is a good idea, since the AV can leave their seat in number of ways some of them making permissions void if i get it right.
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
08-11-2006 10:08
From: Joannah Cramer One way to fix this would be to store key of sitting avatar in a global variable, then when you detect id == NULL which means avatar stood up, send this memorized key to your animation script so it knows who to stop the animation for.
And yeah, doing a check for permission to animate (the if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) bit) also on stop animation is a good idea, since the AV can leave their seat in number of ways some of them making permissions void if i get it right. Yes..I already store the key and pass it on to the the linked script so I correctly handle the case you describe (avatar gets up). I'll try adding the call to llGetPermissions and another request for permission (if necessary) when the avatar stands up and see what happens. Thanks -2fast
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
08-11-2006 11:10
I think they changed something recently where animation permissions are automatically revoked when you stand up. And I think animations are automatically stopped as well, maybe. Anyway, so the llStopAnimation call is probably not needed any more. I remember when they changed it and lots of peopel complained because poseballs everywhere were throwing error messages. There was a long discussion on the 'right' way to handle permissions. See if you can find that thread.
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
08-11-2006 11:20
OK, i gave your scripts a try and they seem to work fine for me.
What _did_ cause issue when i tried was llSitTarget() call with (ZERO_VECTOR, ZERO_ROTATION) as parameters. Simply because this actually removes sit target from a prim, resulting in NULL_KEY being reported all time as person Id, as mentioned earlier. Maybe this is what's causing you the problem?
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
08-11-2006 12:55
From: Joannah Cramer Maybe this is what's causing you the problem? Thank you for trying and verifying the scripts  I knew about the ZERO_* constants and used tiny offsets to avoid that problem. I am on a dead slow connection at the moment and will try this again when I can login. Thanks again -2fast
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-11-2006 13:49
From: Joannah Cramer ... that's right, your id becomes NULL_KEY, and you are then telling your animation script to stop animation for NULL_KEY (rather than for AV who was sitting on that spot) ... for which it obviously have no permission.
One way to fix this would be to store key of sitting avatar in a global variable, then when you detect id == NULL which means avatar stood up, send this memorized key to your animation script so it knows who to stop the animation for. That's not true. 'llStopAnimation()' doesn't take a key as a parameter. It automatically acts on the avatar for which permissions are obtained (same key as 'llGetPermissionsKey()'). I suspect the problem might be--as people have said--that permissions are automatically revoked when the avatar stands, in which case... From: someone And yeah, doing a check for permission to animate (the if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) bit) also on stop animation is a good idea, since the AV can leave their seat in number of ways some of them making permissions void if i get it right. yes, that should fix it. BTW, if you DO still have permissions at the time you'd like to stop the animation, it might also be polite to release them using: llRequestPermissions(llGetPermissionsKey(), 0);
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-11-2006 13:54
Oh, by the way, I don't really see a reason to have the 'changed' even handler in the money script. Better would be to put that in the pose script and if they other script needs to know about seating also, either have two 'changed' event handlers or communicate in the other direction using link messages. It's just a little more encapsulated that way. Shouldn't really make a difference in terms of functionality though.
|
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
08-11-2006 18:50
From: Hewee Zetkin Oh, by the way, I don't really see a reason to have the 'changed' even handler in the money script... Fantastic...got it working  I followed your advice Hewee and you're right, it is much more encapsulated and has the same functionality. Thank you to everyone else that responded  -2fast
|