I recently needed >200 variables and I needed to refer to them programatically somehow, not by name. So here is a useful funtion to let you all do that.

value() uses a rotation variable to store 16 2-digit integers. You can adjust to script to store 8 4-digit integers or 32 1-digit integers.

Variables 0-3 are stored in the x coordinate, 4-7 in the y coordinate, 8-11 in z, 12-15 in s. This sample code uses 2 rotations, so variables 16-31 are in the second rotation.

I was able to store my 200 variables in 13 rotations, saving a lot of memory.

Enjoy!

Usage:

integer value(integer set, integer index, integer v)

set - TRUE is you are setting a variable, FALSE if retrieving

index - the variable number to get/set

v - the value to set. ignored if set is FALSE

returns 0 if set is TRUE.

return the value if variable at index if set is FALSE.

CODE

rotation a;

rotation b;

integer

value(integer set, integer index, integer v)

{

rotation rot;

float fl;

float i = llFloor(index/16.0);

float j = llFloor((index-(i*16))/4.0);

float k = (index-(i*16)) - (j*4);

if (i == 0) rot = a;

else if (i == 1) rot = b;

if (j == 0) fl = rot.x;

if (j == 1) fl = rot.y;

if (j == 2) fl = rot.z;

if (j == 3) fl = rot.s;

if (set == FALSE) {

float fl2 = llFloor(fl / llPow(100,k));

float fl3 = fl2 - llFloor(fl2/100.0)*100.0;

return (integer)fl3;

} else {

float existing = llFloor(fl / llPow(100,k));

existing = existing - llFloor(existing/100.0)*100.0;

fl = fl - (existing * llPow(100,k));

fl = fl + (v * llPow(100,k));

if (j == 0) rot.x = fl;

if (j == 1) rot.y = fl;

if (j == 2) rot.z = fl;

if (j == 3) rot.s = fl;

if (i == 0) a = rot;

else if (i == 1) b = rot;

return 0;

}

}