|
Core Taurog
Registered User
Join date: 2 May 2007
Posts: 17
|
08-19-2007 12:28
Hi, I'm getting really frustrated with permissions, I wonder if anyone can help me out. My code does the following: rez_prim() { if (llGetPermissions() & PERMISSION_CHANGE_LINKS) { llRezObject("Object", llGetPos() + <1.0, 1.0, 0.5>, ZERO_VECTOR, ZERO_ROTATION, 0); } else { llOwnerSay("need PERMISSION_CHANGE_LINKS, but don't have it! :("); } }
default { state_entry() { llOwnerSay("requesting change link permission (for creating the new prim)"); llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS); }
object_rez(key id) { llCreateLink(id, TRUE) ; if (llGetLinkName(2) == "Object") { llSetLinkPrimitiveParams(2, [PRIM_TYPE, PRIM_TYPE_SCULPT, current_sculpt_map, PRIM_SCULPT_TYPE_SPHERE, PRIM_TEXTURE, ALL_SIDES, current_texture_key, <1.0, 1.0, 0.0>, <0, 0, 0>, 0.0]); llBreakLink(2) ; } else { llOwnerSay("There appears to be a permission problem; I think I have PERMISSION_CHANGE_LINKS, but LSL disagrees"); } } }
The reason for all the tests is because the permission seems to be so unreliable. It now works consistently for me (though it didn't for about 2 hours, before finally deciding to work without my having changed anything), but when I give it to someone else, it rezzes the object (i.e. (llGetPermissions() & PERMISSION_CHANGE_LINKS) is true), but then gives script errors when it actually tries to do the link. I'm getting really frustrated, as I really can't see what I'm doing wrong, and it works fine for me - I really don't want to put an script in the rezzed object, as that will be a security hole that I don't want to have to fix  any help would be appreciated, thanks, Core
|
|
Rohacan Hirons
Registered User
Join date: 13 Jun 2007
Posts: 10
|
08-20-2007 02:48
Hi,
When you give it to someone, your object havn't modify permission, it's why it cannot change links. I have this problem. I have tio give modify permissions to other if I want their pod (my object) explosed (with breaklink)
I think it's really silly, I think permission to change links should work without give permission to modify the object
Why we have to give modify permission ? The script that will change links is already in the object, therefore there is no reason to prevent the script to change links when owner havn't permission to modify this object.
I would tell this to SL team, but as you can see my english is very very poor
Hope you'll can understand me
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
08-20-2007 11:15
You want to put the createlink function in the run_time_permissions event.
run_time_permissions(integer perm) {
llCreateLink(id, 0); } }
What's happening is that you're requesting the permission in the state entry, but you're executing the link command in the rez.
There's no real way to be sure the link command happens after the permission request except by running it from the run_time_permissions event.
You'll want the on_rez function to store the key into a global variable, which the run_time_permission event can access.
|
|
Core Taurog
Registered User
Join date: 2 May 2007
Posts: 17
|
08-20-2007 11:30
Ah, thanks Rohacan; I guess that does explain it, though it's very frustrating. Jotheph I think you're confusing on_rez with object_rez; on_rez is what gets called when the object the script is in is rezzed, object_rez is called (with the key of the new object) whenever the script rezzes an object of its own. (I know that I have PERMISSION_CHANGE_LINKS when I rez the object, because I don't accept touch events until I get the permission back). (or possibly my putting the code in two blocks when they're in the same file caused the confusion, /bad core!) I guess I'm just going to have to switch to IMing the new object with the details, which I really didn't want to do, since I means I have to encrypt the traffic, which isn't exactly easy to get secure given the limitations in LSL  thanks, Core
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
08-20-2007 12:56
From: Core Taurog Ah, thanks Rohacan; I guess that does explain it, though it's very frustrating. Jotheph I think you're confusing on_rez with object_rez; on_rez is what gets called when the object the script is in is rezzed, object_rez is called (with the key of the new object) whenever the script rezzes an object of its own. (I know that I have PERMISSION_CHANGE_LINKS when I rez the object, because I don't accept touch events until I get the permission back). (or possibly my putting the code in two blocks when they're in the same file caused the confusion, /bad core!) I guess I'm just going to have to switch to IMing the new object with the details, which I really didn't want to do, since I means I have to encrypt the traffic, which isn't exactly easy to get secure given the limitations in LSL  thanks, Core Yes, but what threw me is that you put the object_rez function in the script of the object being rezzed. At least, that's what it looks like. Am I mistaken or is the second section of code in the rezzed object? I assumed the top was the rezzing prim since it has the rez command.
|
|
Core Taurog
Registered User
Join date: 2 May 2007
Posts: 17
|
08-20-2007 13:04
it was my fault; it's only two small bits of the same piece of code - I should have made that clear. I wanted to avoid putting any scripts in the rezzed object at all, but I need to be able to modify it; the only way that I could see to do that was via linking it and using llSetLinkPrimitiveParams. Since the rezzed object has to have full perms (to be useful to the person rezzing it), putting scripts into it seemed a potential exploit; I'll just have to try code around that 
|
|
Jotheph Nemeth
Registered User
Join date: 9 Aug 2007
Posts: 142
|
08-20-2007 23:19
From: Core Taurog it was my fault; it's only two small bits of the same piece of code - I should have made that clear. I wanted to avoid putting any scripts in the rezzed object at all, but I need to be able to modify it; the only way that I could see to do that was via linking it and using llSetLinkPrimitiveParams. Since the rezzed object has to have full perms (to be useful to the person rezzing it), putting scripts into it seemed a potential exploit; I'll just have to try code around that  ah, ok. Well, worse case, you can put the create link call in the run time permissions, and just do the request_permission call in the object_rez function or wherever else you are trying to kick off the link. The advantage to that is it will never happen except with permission. I've had similar problems with permissions not working when it should with setting animations. Now I just throw it into run_time_permissions and just do a request where I need it.
|