Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Finding an Objects Key

Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
12-01-2007 11:48
I need to find an objects key to use the llGetObjectDetails function - how can i get the key of the detail to pass as a parameter to the function!

Thanks

Andy
Xhawkx Holden
Registered User
Join date: 1 Nov 2006
Posts: 86
12-01-2007 12:14
llGetKey()
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
12-01-2007 12:23
It depends on where the object is. If it's in the same prim as the script then use llGetInventoryKey.

If it's an arbitary object in-world, it's more complicated. I'm not aware of a function that can focus on just one object and get its UUID. You would have to use llDetectedKey where your object collides with or senses the other object within a collision or sensor event.

If you happen to own the object whose key you are trying to get, you could have a script in it that uses llGetKey() to get its own key and then broadcast that on some specified channel the the other object listened to. Or you could have the two objects communicate via email
Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
12-01-2007 12:45
no.

I have a cube within a sphere.

When you click sit - i want the person to sit on the cube which is inside the sphere.

Thus i have :

in pseudo code:

vector = get cubes position;

llsetsitTarget(vector, other params) on the sphere

But when it runs, the whole of second life goes MAD and i get lost in a random mess in the sky!

What am i doing wrong!?

Andy
Renee Roundfield
Registered User
Join date: 10 Mar 2006
Posts: 278
12-01-2007 13:07
if you make the cube the root prim, that's the first seating place. But I may not be seeing what you are trying to do.
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
12-01-2007 13:12
Perhaps you could post the code you are trying to use. I still have some unanswered questions here. Are the 2 objects linked? If so, which is the root prim?
Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
12-01-2007 13:27
not linked but they shall be.

the root is the sphere with the cube inside it..... which is where i want the seat to be. I cannot get back t my object at the moment for various reasons.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-01-2007 13:36
From: Armstrong Clip
no.

I have a cube within a sphere.

When you click sit - i want the person to sit on the cube which is inside the sphere.

Thus i have :

in pseudo code:

vector = get cubes position;

llsetsitTarget(vector, other params) on the sphere

But when it runs, the whole of second life goes MAD and i get lost in a random mess in the sky!

What am i doing wrong!?

Andy



The cube is going to be linked to the sphere. The cubes position is really irrelevant. llSitTarget is going to offset from the position of the object it is in. You could do a bunch of stuff to get the dif between the cube and the sphere and use that. But it is really just much easier to adjust the llSitTarget until they are sitting where you want.

2 meter dia sphere with a .5 meters cube in it's center: llSitTarget<0.0,0.0,0.5> or so.
_____________________
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
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
12-01-2007 13:42
Set the sit target on the object inside the sphere and make sure the sphere does NOT have a sit target defined. Then, when you attempt to sit on the sphere, you will instead sit on the sit target, which is the cube inside the sphere.

When sitting on an object, you will sit on the highest link-numbered prim with a sit target defined which is not already occupied by someone sitting on it, or the prim you selected to sit on if no unoccupied sit targets are defined.
Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
12-01-2007 13:46
em right , to the last reply - could you go into more detail, i set the sit target to be the cube - thats what i was wanting to do, it makes sense, or i was going to use the vector position list to work out where to set the llsit target
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-01-2007 14:45
From: Armstrong Clip
em right , to the last reply - could you go into more detail, i set the sit target to be the cube - thats what i was wanting to do, it makes sense, or i was going to use the vector position list to work out where to set the llsit target

If you have a sphere with or without a cube in it and the llSitTarget is defined in the sphere as <0.0,0.00.25> then the avatar will sit just above the center of the sphere. This would keep you from having to put a script in the cube if all it is going to do is define the sit target.

If for some reason you do really want to use the cube's sit target then what Talarus was refering to is explained here:

http://www.cheesefactory.us/lslwm/llSitTarget.htm

Look towards the bottom of the page at: "Linked Objects With Multiple Sit Targets"

As an example and as long as the sphere doesn't have a sit target defined, you could put this script in the cube. As long as the cube is linked to the sphere, when they choose sit, they will sit 0.25 meters above the center of the cube:

CODE

default
{
state_entry()
{
llSitTarget(<0.0,0.0,0.25>,ZERO_ROTATION);
}
}
_____________________
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
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
12-01-2007 15:02
I've been fooling around with this. There is as much to building this as there is to scripting it. I assume you know how to build it and to link the parts together. As Jesse points out, the sit target used in llSitTarget is an offset from the center of the sphere. This offset will depend on the position of the cube inside the sphere and its size. So if the center of the cube is 1.0 m below the center of the sphere, and the cube itself is 1.0 m on each side, the z component of the sit offset is -0.5 (cube's offset from sphere's center + 0.5 the size of the cube). You would apply the same principle to the other coordinates. So, if the cube were x,y centered on the sphere and had a z offset as above your code would look like llSitTarget(<0.0,0.0,-0.5>,ZERO_ROTATION). You could put this in the state_entry event. Make sure that the rotation of the cube and the sphere are the same before you link them or it won't work right. Also when I hollowed the sphere, I got trapped inside when I tried to unsit. So keep the sphere not hollowed.
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
12-01-2007 15:49
I've been experimenting with Talarus's suggestion of setting the sit target in the cube. I like that idea since you don't have to mess with the cube's offset from the sphere as I suggested earlier. So, I set the sphere as the root prim, making sure to have cleared any previous sit targets I may have assigned to it, and then put the llSitTarget in state_entry of the script in the cube. I works as Talarus points out. However, I'm having trouble figuring out the z component of the offset as Armstrong points out. I would have thought it would be half the height of the cube but that sits me inside the cube, not on top of it. If I enter the height of the cube, I sit hovering slightly above it. Is there so formula to this that I'm missing?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-01-2007 16:01
From: Monica Balut
However, I'm having trouble figuring out the z component of the offset as Armstrong points out. I would have thought it would be half the height of the cube but that sits me inside the cube, not on top of it. If I enter the height of the cube, I sit hovering slightly above it. Is there so formula to this that I'm missing?

llSitTarget defines where the center of your avatar will be. So it basically depends on the distance from your center to the edge of your butt :p
_____________________
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
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
12-01-2007 16:04
So there's no real formula for this. It's just trial and error until you get something that looks ok.
Armstrong Clip
Registered User
Join date: 27 Nov 2007
Posts: 11
12-01-2007 16:28
seems so.

I thikn i will settle on :

CODE

rotation rotUpright = llEuler2Rot(<90,270,0> * DEG_TO_RAD); //turn me round

llSitTarget(<-1.0, -0.37, -0.40>, rotUpright);


Seems easiest.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
12-01-2007 16:36
From: Monica Balut
So there's no real formula for this. It's just trial and error until you get something that looks ok.


Sure there's a formula for it... for the default SL avatar of average height. However, it still will look wrong if I in my anthro full-prim av Dragon form sit on it with that computation. The upshot is, just set it to one particular value that looks close enough, and don't sweat the differences that everyone else has when sitting on it. Otherwise, you will have to make a seat with a configurable sit target that the user can select before sitting (I've made one of those).
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-01-2007 21:13
WOOT!

Have an easy way to set the llSitTarget now:

/54/0c/227162/1.html
_____________________
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