Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSetPos help needed

Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
08-09-2009 03:17
im trying to make an object set its regional position to either the position of another prim such as a base or by what i set in its description field. im having troubles of how to do the 1st way and the 2nd way keeps having the error of not being able to go from string to vector and i cant solve it. ide like help for either way or both if possible thanks.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-09-2009 03:37
vector pos = (vector) "< 1,2,3>";
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-09-2009 03:43
if the object you are trying to get a source position from is within 96m you could fire a one time sensor to detect it.

if it's not, but you know it's key in the sim you can use get object details.

if neither of those are options you can have the source advertise it's location via region say.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Jaxith Zapatero
Registered User
Join date: 24 Dec 2008
Posts: 20
08-09-2009 03:54
ok having it say its position by region say is what i was thinking but in not exactly sure how to have the one prim say the "ship" ask for the "base's" position then goto that position. i understand the concept but not sure what to use plus i think that will still have an issue with trying to set a vector but being given a string
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-09-2009 03:59
Use a cast.

eg:

vector pos = (vector) stringContainingAVector;
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-09-2009 08:11
CODE

/*
object description:
example 1: < 0,0,1>
example 2: < 0,0,11>
llSetPos will only move a maximum of 10 meters
This script will only work for example 1
*/

default {
touch_start(integer n) {
vector description = (vector) llGetObjectDesc();
vector destination = llGetPos() + description;
llSetPos(destination);
}
}

CODE

/*
object description:
example 1: < 0,0,1>
example 2: < 0,0,11>
llSetPos will only move a maximum of 10 meters
This scripts will work for either example
*/

default {
touch_start(integer n) {
vector description = (vector) llGetObjectDesc();
vector destination = llGetPos() + description;
while(llVecDist(llGetPos(), destination) > 0.1){
llSetPos(destination);
}
}
}

Alternatively if you want to move more then 10 meters instantaneously you can look at warpPos in the wiki.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum