You will be aware that I'm a lousy programmer with limited knowledge of LSL. So I'll sincerely welcome any suggestions, improvements or comments you choose to offer!
The prim this script goes in:
* Gives its owner's dimensions, but only if it is touched by its owner.
// Cherry Hainsworth, December 2007
// VARIABLES USED IN THIS SCRIPT:
// key ownerav; (avatar owner of the scripted prim)
// string ownername; (owner avatar's name)
// vector size; (a size)
// float height = size.z; (size vectors; casting to floats didn't work)
// float widthX = size.x;
// float depthY = size.y;
// string msg1 (etc)
// -------------------------------------------------
// declare globals
key ownerav;
string name;
vector size;
// -------------------------------------------------
default {
state_entry() {
}
touch_start(integer num)
{
// if I was touched by my owner
if (llDetectedKey(0) == llGetOwner())
{
//get their name & dimensions
ownerav = llGetOwner();
size = llGetAgentSize(ownerav);
// tidy up the size data
float height = size.z;
float widthX = size.x;
float depthY = size.y;
// keep it tidy, create the message
string ownername = llKey2Name(ownerav);
string msg1 = ", your height is " + (string)height;
string msg2 = ", your width X is " + (string)widthX;
string msg3 = ", your depth Y is " + (string)depthY;
llSay(0, ownername + msg1 + msg2 + msg3 );
llResetScript();
}
else
// don't reveal my size to strangers!
{ llSay(0, "oops, you're not my owner"
;
}
llResetScript();
}
}
// VARIABLES USED IN THIS SCRIPT:
// key ownerav; (avatar owner of the scripted prim)
// string ownername; (owner avatar's name)
// vector size; (a size)
// float height = size.z; (size vectors; casting to floats didn't work)
// float widthX = size.x;
// float depthY = size.y;
// string msg1 (etc)
// -------------------------------------------------
// declare globals
key ownerav;
string name;
vector size;
// -------------------------------------------------
default {
state_entry() {
}
touch_start(integer num)
{
// if I was touched by my owner
if (llDetectedKey(0) == llGetOwner())
{
//get their name & dimensions
ownerav = llGetOwner();
size = llGetAgentSize(ownerav);
// tidy up the size data
float height = size.z;
float widthX = size.x;
float depthY = size.y;
// keep it tidy, create the message
string ownername = llKey2Name(ownerav);
string msg1 = ", your height is " + (string)height;
string msg2 = ", your width X is " + (string)widthX;
string msg3 = ", your depth Y is " + (string)depthY;
llSay(0, ownername + msg1 + msg2 + msg3 );
llResetScript();
}
else
// don't reveal my size to strangers!
{ llSay(0, "oops, you're not my owner"
;}
llResetScript();
}
}
(no apologies for misuse of the quote tag!)
QUERY:
I tried various methods to truncate or round down the size vectors - I only need 3 places, max - but kept getting a type mismatch. Any suggestions?
Please let me know if I should continue with this.
Cheers,
Cherry.
***** HAPPY CHRISTMAS, SCRIPTERS! *****

