Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

using llGetPrimitiveParams in a self aware door

Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
01-13-2007 10:51
hi all, I have a multi prim door I want to open & close on click.

have found this nice script: (from http://www.jeff-barr.com/?cat=13 )

CODE

vector OpenPos = <149.283, 75.009, 77.3681>;
vector OpenRot = <0, 270.0, 270.0>;
vector ClosedPos = <151.681, 75.009, 75.009>;
vector ClosedRot = <0, 0, 270.0>;

default
{
state_entry()
{
state closed;
}
}

state closed
{
touch_start(integer N)
{
state open;
}

state_entry()
{
llSetPos(ClosedPos); llSetRot(llEuler2Rot(ClosedRot * DEG_TO_RAD));
}
}

state open
{
touch_start(integer N)
{
state closed;
}

state_entry()
{
llSetPos(OpenPos); llSetRot(llEuler2Rot(OpenRot * DEG_TO_RAD));
}
}


(sorry if it's formatted badly! you can see it in the link, it's nicer there.)

my question is, as this code needs to be set with the open & close values on ressing the door every time (it'll be used in a sandbox environment for now), can I replace

vector ClosedPos = <x, y, z>;

with

vector ClosedPos = <llGetPrimitiveParams(PRIM_POSITION)>

and the vector OpenPos with

vector OpenPos = <llGetPrimitiveParams(PRIM_POSITION)> - <a, b, c>

?

(where <a, b, c> is some transform vector. as the doors open and close positions will have the same position relative to each other every time. )


thanks for your time :) also, my syntax is obviously terrible, what's the correct way to use llGetPrimitiveParams like this?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-13-2007 14:32
Afraid the answer is no as llGetPrimitiveParameters will return you a list of all the prim parameters. You would have to manually filter through the list until you found the position.

However whats wrong with using llGetPos ?
Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
01-13-2007 14:52
I've never coded in SL before, so I'm sure there's nothing wrong with llGetPos :D

is there one for get rotation too? llGetRot ?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-13-2007 15:45
From: Dominguez Brentano
I've never coded in SL before, so I'm sure there's nothing wrong with llGetPos :D

is there one for get rotation too? llGetRot ?



yep and lots of others. Look here
Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
01-13-2007 16:24
From: Newgate Ludd
yep and lots of others. Look here



awesome, thanks :)