Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Ignore me, I'm dumb

Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
01-26-2009 14:13
Edit: nevermind. D'oh! This script is in the root prim, so of course llSetPos moved the object.

original dumb post follows...

According to the wiki, llSetPos for child prims is local to the root prim:

http://wiki.secondlife.com/wiki/LlSetPos

Yet, when I run this code, the object is launched toward the region's 0,0,0 coordinate:

readLinkset()
{
integer nprims = llGetNumberOfPrims();
integer i;
for ( i = 0; i <= nprims; i++)
{
if ( llGetAgentSize( llGetLinkKey( i)))
{
// avatar
nprims--;
}
else
{
//not an avatar
string linkname = llGetLinkName(i);
if ( i > LINK_ROOT && llGetSubString( linkname, 0, 2) != "ref";)
{
llOwnerSay(linkname);
llSetPos( < 0,0,0 >;); // center prim
}
}
}
}

The name of the object is M02A-1 and the output of this code looks like this:

[13:58] M02A-1: outer ring
[13:58] M02A-1: upper
[13:58] M02A-1: lower
[13:58] M02A-1: back
[13:58] M02A-1: inner ring
[13:58] M02A-1: fl3
[13:58] M02A-1: fl4
[13:58] M02A-1: fl2
[13:58] M02A-1: fl1
[13:58] M02A-1: fd2
[13:58] M02A-1: fd1

Note that there's no output for the prim named M02A-1 (the root), so it's not being positioned. Only the child prims are. Yet, this code launches the object toward the region's 0,0,0 coordinate.

Is the wiki wrong? And did this recently change?
_____________________
The Vengeance Studio Gadget Store is closed!

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-26-2009 14:23
Hey you were smart enough to catch the error yourself. I would say that counts for something!
_____________________
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
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-26-2009 16:38
Ah yes. And you can't really reposition the root prim via script like you could with "Edit linked parts" in the Edit Window. Instead you have to reposition all the OTHER prims in the opposite manner (which I presume is what using "Edit linked parts" on the root prim does anyway).

Note also that if llGetNumberOfPrims() is greater than one, there IS no link at index 0. They instead start at 1. It is unfortunate that using LINK_ROOT in the library functions doesn't account for this, but it doesn't. Only use LINK_ROOT when you KNOW there is more than one prim in the link set. Kind of a worthless constant IMO.