User:Ugleh Ulrik/Vector2List: Difference between revisions
Jump to navigation
Jump to search
Ugleh Ulrik (talk | contribs) No edit summary |
Ugleh Ulrik (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
With many requests on how to easily store a vector to a list, mainly for purposes in storing a [b]llGetPos()[/b] only to capture the x and y cords, this is a simple way. | |||
For Example | For Example | ||
Revision as of 00:40, 19 April 2010
With many requests on how to easily store a vector to a list, mainly for purposes in storing a [b]llGetPos()[/b] only to capture the x and y cords, this is a simple way.
For Example
list thislist = Vector2List(llGetPos());
As a list, would output
list thislist = [x,y,z];
Function
list Vector2List(vector v){
list alist = llParseString2List((string)v,[",", ">", "<"],[]);
return alist;
}
An Example
list Vector2List(vector v){
list alist = llParseString2List((string)v,[",", ">", "<"],[]);
return alist;
}
default
{
touch_start(integer total_number)
{
list thislist = Vector2List(llGetPos());
string x = llList2String(thislist,0);
string y = llList2String(thislist,1);
string z = llList2String(thislist,2);
llOwnerSay("X Axis: " + x);
llOwnerSay("Y Axis: " + y);
llOwnerSay("Z Axis: " + z);
}
}