Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetPrimitiveParams question

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
01-05-2006 11:48
I am attempt to determine the size and rotation of a prim from when the prim and to place those values into variables. This is necessary for the calculation in the script to work correctly even if the prim has been resized. Can I use llGetPrimitiveParams([PRIM_SIZE, PRIM_ROTATION]); to do this, and if so, how do I set the variables to the values that are returned by the function? Thanks, Mod
Deneria Sholokhov
Leaf on the Wind
Join date: 25 Oct 2005
Posts: 12
01-05-2006 12:15
You would want to do one something like this:

list my_list = llGetPrimitiveParams([PRIM_SIZE, PRIM_ROTATION]);
vector my_obj_size = llList2Vector(my_list, 0);
rotation my_obj_rot = llList2Rot(my_list, 1);

I strongly recomend using llGetListEntryType to verify the list contents before using them, but that should get you started
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-05-2006 12:40
Optionally you can use:

CODE

rotation objRot = llGetRot(); // Sets the object's current rotation in variable objRot
vector objSize= llGetScale(); // Set the object's current size in variable objSize


Just remember that this code
CODE
rotation objRot = llGetRot();
declares and sets the variable at the same time.

If you are going to set them again within the same function then you need only to use this code anywhere else in that function:
CODE
objRot = llGetRot();   


If you want these to be global variables (only have to declare them once) then you need to declare them at the top of the script, above everything else like this:
CODE

rotation objRot; // Declare variable objRot
vector objSize; // Declare variable objSize


Then you can set them later in the script when you need to.
This allows allows the variables to be global throughout the script. Which means that the data stored in the variable can be accessed from any function without having to set them again.

Sorry if I've overexplained :o
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Thanks
01-05-2006 13:10
Thanks Deneria and Damien for the help. This sould at least get me to the next question lol.

Mod
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-05-2006 13:33
No problem :)