Popgun permissions
|
Zax Razorfen
Registered User
Join date: 9 Aug 2009
Posts: 2
|
08-29-2009 14:41
I'm using the popgun script from the library to create a multi-player game and it works fine for me but no-one else is able to attach the gun. It looks like it is failing to get permission. In the default popgun script is the following: attach(key attachedAgent) { if (attachedAgent != NULL_KEY) { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION| PERMISSION_TAKE_CONTROLS); } ...
Now, the way I understand it is that I am still the owner regardless of who has just attached the gun and so the above would not work for anyone else so I have changed the script to: attach(key attachedAgent) { if (attachedAgent != NULL_KEY) { llRequestPermissions(attachedAgent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS); } ...
It seems logical to ask permission from the avatar that attached the gun but this does not work either. I could fiddle around with this but I'd really appreciate it if someone would give me a basic overview of how permissions and ownership works and what I need to do to get my gun useable by anyone other than me. Any help much appreciated Cheers
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
08-29-2009 15:42
My understanding is that only the owner of an object can attach it, and then only to themselves.
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
08-29-2009 18:40
Right: the owner will always be the person who attaches it, otherwise they just won't be able to attach it. I've never found a completely smooth way to make this work. About the best I've come up with is an attachment with a default left-click action of selling itself as original for L$0, and on change(CHANGED_OWNER) it asks permission to attach and tells a rezzer to replace it. Probably best to have it set itself temporary, too, to avoid clutter if the buyer doesn't approve the attachment, and then set back to permanent on attach. I had to abandon this trick for a particle system application, however, when I discovered that particles aren't emitted from the right place when attached from in-world instead of from Inventory. http://jira.secondlife.com/browse/SVC-1765
_____________________
Archived for Your Protection
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
08-30-2009 07:52
Hmm... yea... both of your code examples should function inherently the same way, and they both look correct. Perhaps something else in your code is the problem?
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
08-30-2009 15:52
both those segments look good, and you can actually shorten it just a bit, since we know only the owner can attach an object.. default{ attach( key vKeyWrn ){ if (vKeyWrn){ llRequestPermissions( vKeyWrn, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS); } }
//-- and this verifies you have the requested permissions run_time_permissions( integer vBitPrm ){ if (vBitPrm & (PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS)){ llOwnerSay( "I have permissions" ); }else{ llOwnerSay( "you denied permissions, re-wear me to try again" ); } } }
can't remember but I think you get a dialog because of the take controls from an attachment, and I don't know if that shows up if you're in busy mode
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
08-30-2009 16:28
From: Void Singer can't remember but I think you get a dialog because of the take controls from an attachment, and I don't know if that shows up if you're in busy mode
I just tried it in a script I'm working on and it doesn't pop up a dialog for PERMISSIONS_TAKE_CONTROLS.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
08-30-2009 16:42
good to know, thanks for testing that (I always have trouble remembering what does pop a dialog and what doesn't in a given set of circumstances)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Zax Razorfen
Registered User
Join date: 9 Aug 2009
Posts: 2
|
Sorted 
09-01-2009 01:27
Thanks for your replies guys. They've helped me to see my requirement in a different way. I suppose it would be better for me to leave the guns and other equipment for users to buy for L$0 and then they can attach them. That way, they can keep their equipment and come back whenever they like without having to get all the stuff again.
Thanks again.
|
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
|
09-01-2009 01:45
From: Zax Razorfen I suppose it would be better for me to leave the guns and other equipment for users to buy for L$0 and then they can attach them. That way, they can keep their equipment and come back whenever they like without having to get all the stuff again. If there is a set of equipment involved it'd be even more convenient for the users were you to to use llGiveInventoryList to give them the whole lot in one folder when they clciked on a "giver" prim (llGiveInventory for a single item). Even so, setting a buy price of 0, and marking the object(s) as free to copy would cover other approaches people might adopt in trying to aquire them.
|