Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Setpos question o.o

Thili Playfair
Registered User
Join date: 18 Aug 2004
Posts: 2,417
06-18-2006 02:21
Okeey, trying to figure out if this ever work properly, need some way to do i to set up some things thats not linked , so they center on another prim when asked.

So far its been..um... interesting wierd :P

Tried this and it usually ended up waaay far from where it was headed xyz wise, did i miss something?.

CODE

listen( integer channel, string name, key id, string message )
{
//llSetPos(<(float)message,0,0>


Tried setting objectname to xyz from other prim, timer then ask itself what its name is and set, didnt work, pretty much the same wierdness, then try asking twice to see if that worked uh no,...

client side maybe had some people look and it was off for them to.
Copper Surface
Wandering Carroteer
Join date: 6 Jul 2005
Posts: 157
06-18-2006 02:31
Hi Thili. Not sure what you actually want to do. Do you want to say a set of coordinates and then have the object travel there?

You might try: llSetPos((vector)message);
And the message should be of the form: <3.0,1.0,4.0>
Also, llSetPos will only move the object 10m towards the destination, if the destination is further than 10m away.
Thili Playfair
Registered User
Join date: 18 Aug 2004
Posts: 2,417
06-18-2006 03:08
ah yeh, i got a prim that says something to another (not linked) and want it to move where it is

sender
(prim has no name, but only stays active a few seconds)


CODE

default {
touch_start(integer num_detected)
{
(0, "/me " + (string)llGetPos());}
}

reciver
(wich is doing odd stuff)
(same thing dies after 1 sec when its done its stuff)

[left]
CODE

default
{
state_entry()
{
llListen( 0, "", NULL_KEY, "" );
}

listen( integer channel, string name, key id, string message )
{
llSetPos(<(float)message,0,0>);
llOwnerSay((string)llGetLocalPos());
}
}



gives me this 'ish

<213.53308, 22.73062, 235.60542>

pondering if its the < > thats confusing it,
[/left]
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
06-18-2006 04:14
llSetPos(<;(float)message,0,0>;);

should be

llSetPos((vector)message);

...and the sender prim should be saying:

llSay(0, (string)llGetPos());

I'm not sure what's going on with the code in your sender prim as you posted it, doesn't look like it should compile to me. And I'm not sure why you're doing OwnerSay on llGetLocalPos() rather than llGetPos()?
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
06-18-2006 05:25
You also probably shouldn't use channel zero, it's horrible :)

Lastly, llSetPos() can only move an object 10m at a time, so you either need to have a loop which does it repeatedly, or the better alternative is to use the WarpPos function which you can find here, just copy that somewhere above your default state, and then instead of calling llSetPos((vector)message) you can call warpPos((vector)message) to move any distance. In your case since you're using llSay() it will only hear the message if it's within 20m of the sending object, but still, the 10m limit might hit you.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Thili Playfair
Registered User
Join date: 18 Aug 2004
Posts: 2,417
06-18-2006 10:36
thanks guys \o

yeh its just a test so i had it at 0, when recived it changes state to not listen anymore ,

now to fix my dice: p