Permission problem?
|
|
Leyre Demonia
Registered User
Join date: 23 Dec 2007
Posts: 4
|
05-21-2008 23:33
Hello all,
This is my first post on the forums, although i've been reading it for a while.
I have the following problem:
I have 2 objects and pleople can change the image on prim 1 by touching prim 2 (they can choose an image from a menu).
Prim2 sends the key of the selected image via llResionSay to prim 1 and it displays it. This works well when the object is mine, but if i give it to someone else, it stops working.
I tried making objects and images full perm and it works again, but i dont want other people to just copy the images. Is there another way of doing this?
Thanks in advance.
|
|
Georg Stonewall
Husband of Nikki
Join date: 21 Jan 2007
Posts: 211
|
05-21-2008 23:46
It's not easy to answer without knowing your script, but I guess the new owner has to reset the script. Or you use the llResetScript function in the onrez event.
_____________________
G&N Quality Design SLURL  Blog  Flickr  XStreetSL 
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
05-22-2008 00:26
When a script is created, the owner is 'read' by the object, and this information is 'saved' by the object, and persists even if the object changes ownership. To force the object to examine who the owner is you need to call the llResetScript() function. Standard practice is to put this inside an on_rez() event, so that when the new owner rezzes the object in world, the script resets, and the current owner is resaved, therefore:
default {
on_rez(integer foo) { llResetScript(); }
// the rest of your code...
}
will do the trick  So, if you use llGetOwner() anywhere in a script, you'll need to do this so that when transfered, the new owner is re-examined by the script.
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
05-22-2008 00:29
From: Georg Stonewall It's not easy to answer without knowing your script... Yes, it is.
|
|
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
|
05-22-2008 01:14
llGetTexture and the like will work provided the owner has modify, copy and transfer permissions on the object itself. You may be able to get away with making the textures less permissive, or you may just hard-code their UUID's into your script.
|
|
Leyre Demonia
Registered User
Join date: 23 Dec 2007
Posts: 4
|
05-22-2008 02:09
ok.. here is the code, but it wont help much i think.
master object resets when rezzed. It scans its invetory and resets again when changes and makes a list with the keys of the images it finds with
imglist+=llGetInventoryKey(llGetInventoryName(INVENTORY_TEXTURE,x));
This keys are then passed to the slave object, that displays it with (slave object has 2 prims)
setLinkTexture(i,llList2Key(imglist,i),0);
no big deal, but it doesnt work if the object is owned by someone else.
|
|
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
|
05-22-2008 02:19
Ah! Check it: From: http://wiki.secondlife.com/wiki/LlGetInventoryKey If item is not copy, mod, trans then the return is NULL_KEY
This might be seen as especially poor advice, but I wouldn't worry too hard about images being copied on the internet.  However, is there significant reason to populate the texture list when the inventory changes instead of hard-coding the UUID's into the script?
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
05-22-2008 02:29
From: Johan Laurasia When a script is created, the owner is 'read' by the object, and this information is 'saved' by the object, and persists even if the object changes ownership. To force the object to examine who the owner is you need to call the llResetScript() function. Standard practice is to put this inside an on_rez() event, so that when the new owner rezzes the object in world, the script resets, and the current owner is resaved, therefore:
default {
on_rez(integer foo) { llResetScript(); }
// the rest of your code...
}
will do the trick  So, if you use llGetOwner() anywhere in a script, you'll need to do this so that when transfered, the new owner is re-examined by the script. This is not entirely true, as far a I understand the wiki. When you initiate a llListen() using llGetOwner, then it will still listen to the old owner when the object is transferred. This is because, the Listen was initiated when the object belonged to owner A. So all you have to do is kill the old listen and initiate a new one. You can do this in the on_rez()-event, or in the change-state (CHANGED_OWNER). llResetScript isn't always a good idea as sometimes there are some parameters which need to persist, even when the object is transferred. As for the OPs Problem: This is definitely an issue with texture-perms returning a NULL_KEY. Try to llOwnerSay the Keys in your list in the receiving Prim and you'll most likely see the NULL_KEYs.
|
|
Georg Stonewall
Husband of Nikki
Join date: 21 Jan 2007
Posts: 211
|
05-22-2008 02:31
From: someone Originally Posted by Georg Stonewall It's not easy to answer without knowing your script... From: Johan Laurasia Yes, it is. ooops was not 
_____________________
G&N Quality Design SLURL  Blog  Flickr  XStreetSL 
|
|
Leyre Demonia
Registered User
Join date: 23 Dec 2007
Posts: 4
|
05-22-2008 08:25
Thank you all for your answers.
What difference would it make to hardcode de keys instead of passing them?
I will try to reset the listen as well and see what happens.
I'll let you know.
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
05-22-2008 11:42
From: Haruki Watanabe This is not entirely true, as far a I understand the wiki.
When you initiate a llListen() using llGetOwner, then it will still listen to the old owner when the object is transferred. This is because, the Listen was initiated when the object belonged to owner A. So all you have to do is kill the old listen and initiate a new one. You can do this in the on_rez()-event, or in the change-state (CHANGED_OWNER). llResetScript isn't always a good idea as sometimes there are some parameters which need to persist, even when the object is transferred.
As for the OPs Problem: This is definitely an issue with texture-perms returning a NULL_KEY. Try to llOwnerSay the Keys in your list in the receiving Prim and you'll most likely see the NULL_KEYs. My code as written will always work, as far as parameter persistence, once can generally store the needed parameters in the object description, and read them back in in the state entry. Most of what I write and sell is owner only controlled, and I do an llResetScript() in an on_rez() event, and read persistent data in that I save in the object description. It works fine, and it will solve the OP's issue. Dont really understand why this is such a matter of disagreement. According to the wiki: On script reset... * The current event/function is exited without further execution or return. * All global variables are set to their defaults * The event queue is cleared. * The default state is set as the active state * If it has a state_entry event, then it is queued.
|
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
05-22-2008 12:00
IMHO, resetting a script on every rez is akin to having to jump start your car every morning to get it running. It indicates there's something wrong in the workings.
There are ways to write a script to get the same functionality, but not require a reset. In my opinion, that is a bad programming practice.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-22-2008 12:39
There's nothing particularly wrong with using llResetScript() on rez for SOME (usually simple) applications. Stating that it is required however is bogus and misleading.
There is some debate over whether storing a limited amount of data in object name/description just so you can reset the script without losing all data is advisable. I usually argue against, as object name/description isn't primarily intended for script storage (in fact, LL has recently fixed up some issues with the character limits in these fields and even decreased the limits because they were being abused as persistent storage). I occasionally use object description as a sort of script configuration parameter when it also happens to make sense as an object description. For example, using the description field of a teleporter as a descriptive name for the destination makes sense. But as arbitrary data storage it isn't the best choice in the world in my opinion. Note that users will see that description in the object hover tip and such (for the root prim anyway). Notecards (read-only), data storage scripts, and external databases are the way to go for more permanent data storage IMO, at least for the moment.
|
|
Leyre Demonia
Registered User
Join date: 23 Dec 2007
Posts: 4
|
05-25-2008 12:03
Hi all It seams that hard coding UUID's intead of passing the keys soved the problem. But still is not a great solution I guess LSL has serious limitations yet. Thanks again for your answers 
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
05-25-2008 13:30
From: Leyre Demonia Hi all It seams that hard coding UUID's intead of passing the keys soved the problem. But still is not a great solution I guess LSL has serious limitations yet. Thanks again for your answers  Nope no limitations regarding passing the keys in a list to another object and that object using them. How exactly were you passing them? Cast list to string (won't work unless there is only one key in the list), llDumpList2String, llList2CSV? Then you have to load the message back into a list in the reciveing script. Try breaking it down to two simple scripts, The first will only read the inventory, populate the list, convert the list to a string and then pass it. The second will recieve the msg and populate another list with it and then read it out to llOwnerSay, etc. Post what you come up with and we can help get it working.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
05-25-2008 14:28
also check that the texture is full perm for the new owner or you will get back NULL KEY.
In answer to why use a dynamic list rather than hard coding it, purely because its dynamic! If its hard coded then every time you want to update it you have to edit and recompile. Far simpler to allow the script to work out that you have added new textures and process the list itself.
_____________________
I'm back......
|