Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

NOOB Question vector to string?

Parsalin Gullwing
The big PG
Join date: 16 Aug 2004
Posts: 32
01-24-2005 02:59
Is there a way to make an object say the vector of the color on side whatever :P

I need and object when its clicked say its color in chat in vector form so if its red it would say <255,0,0> aloud in chat. If this is possible please help thank you.
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
01-24-2005 03:05
OK, well, it may be possible to do ...

CODE
vector myVect = <1,3.1,1>;
string myString = (string)myVect;


but I don't know if that will work. However, you can split up the components of the vector such that...

CODE
vector myVect = <1,1,1>;
float x = myVext.x;
float y = myVect.y;
float z = myVect.z;

string myString = "<" + (string)x + "," + (string)y + "," + (string)z + ">";


which should work properly.
_____________________
http://siobhantaylor.wordpress.com/
Al Bravo
Retired
Join date: 29 Jun 2004
Posts: 373
01-24-2005 03:06
CODE
touch_start(integer num_detected)
{
llWhisper(0, (string)llGetColor(face));
}

You have to specify 'face'. Touch events don't detect where an object was touched.
_____________________
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
01-24-2005 03:08
From: Al Bravo
CODE
touch_start(integer num_detected)
{
llWhisper(0, (string)llGetColor(face));
}

You have to specify 'face'. Touch events don't detect where an object was touched.


Ah, good point, I missed that one.
_____________________
http://siobhantaylor.wordpress.com/
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
01-24-2005 08:08
From: Siobhan Taylor
OK, well, it may be possible to do ...

CODE
vector myVect = <1,3.1,1>;
string myString = (string)myVect;


This should work and reply a CSV string... I don't think it puts angle brackets around it, but it might do. The ability to split and get x, y, z components out is nice though, for some things.