Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

One Prim geting position of a second Prim

Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
12-13-2005 10:30
I am trying to learn as much as I can through reading the Wiki and the Forum, but being new some of what I read is difficult to follow. I need one prime to tell another priime what's position is, and that prime to get the position of the first. This is either so simple or so obviouly impossiple that I will be embarrassed I did not figure it out. Mod
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
12-13-2005 10:37
From: Mod Faulkner
I am trying to learn as much as I can through reading the Wiki and the Forum, but being new some of what I read is difficult to follow. I need one prime to tell another priime what's position is, and that prime to get the position of the first. This is either so simple or so obviouly impossiple that I will be embarrassed I did not figure it out. Mod


Hmm, the first way that pops into my head (in other words, disclaimer: there might be a better way than this ;) ), assuming your prims are NOT linked to eachother...

put a listen event in each prim, maybe the first one listens on channel -999 and the second on -998...
Then, when you want them to learn eachother's positions, the first one would llSay(-998,llGetPos());
And the second one would llSay(-999,llGetPos());

Hope this helps.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Two child prims
12-13-2005 10:43
Would this approach still work if each is linke to a primary prim?
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
Two child prims
12-13-2005 10:44
Would this approach still work if each is linked to a primary prim?
Zippthorne Pasternak
Registered User
Join date: 6 Dec 2005
Posts: 6
12-13-2005 17:44
You don't need to use the listen event if they're linked. you can use link messages and avoid the overhead of listening all the time.
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
More Help please
12-14-2005 05:34
Here is what I am trying to do. There is a simple free TP available inworld with the followng script:
---------------------------------------------------------------------
vector targetPos = <139,236,104>; //The target location

reset()
{
vector target;

target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(target, ZERO_ROTATION);
llSetSitText(llGetObjectName());
}
default
{
state_entry()
{
reset();
}

on_rez(integer startup_param)
{
reset();
}

changed(integer change)
{
llUnSit(llAvatarOnSitTarget());
reset();
}
}

______________________________________________________________________

What I want to do is for one prim script to get the vector targetPos from another prim scrip
and vis versa. Thus no matter where the two prims are located you can TP from one to the other. I have tried but I am just not getting the communication between the two right. The two prim will be linked to a the same primary prim.

Thanks for you help, MOD
Teneo Hope
Registered User
Join date: 28 Dec 2004
Posts: 16
12-16-2005 22:44
Fun Idea.


Since your idea may mean the objects are beyond chat communication range, look into email communication between objects (llEmail, llGetNextEmail and the email event). Keep in mind that the key of an object is important in email communication so you will need a way to handle that. If the two TP objects never get derezzed then it won't be a problem hard coding the keys. Otherwise you will need to devise a way to keep track of keys between the two teleport objects. Perhaps a third 'server' object, with which both TP objects can communicate with, that never is derezzed or perhaps XMLRPC (the former would be easier imho).