Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with a simple teleporter -Understanding

Okiphia Rayna
DemonEye Benefactor
Join date: 22 Sep 2007
Posts: 2,103
12-08-2007 19:18
i'm working on this script more for my understanding of how it works, but can't for the life of me fix the problem I'm having.

Its *supposed* to teleport you 4m up, acting as a normal teleporter does, no matter where it happens to be (So a movable teleporter, like if you want to put it in a house you're selling).

What it seems to *do* is to send me about 50m away, actually into another sim, when I teleport. Aside from tthat small detail it seems to work fine ;)

Here's my script:

ANd please.. I'm not asking for a more advanced script, I'm asking for a solution to this one, I'm trying to learn scripting and this is one puzzle I haven't been able to solve.

Thankies ^_^


vector pos;
rotate_to_zero()
{
llSetRot(<0,0,0,0>;);
}
default
{
state_entry()
{
llSetSitText("Teleport";);
rotate_to_zero();
llSay(0, "Working";);
pos=llGetPos()+<0,0,4>;
llSitTarget(pos, ZERO_ROTATION);
}
touch_start(integer number)
{
llSay(0, "Right Click and select 'Teleport' to use";);
}
changed(integer change)
{
if(change & CHANGED_LINK)
{
llUnSit(llAvatarOnSitTarget());
llResetScript();
}
}
}
_____________________
Owner of DemonEye Designs Custom Building and Landscaping
Owner and Blogger, Okiphia's Life
http://okiphiablog.blogspot.com/
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
12-08-2007 19:23
The vector argument to llSitTarget is an *offset*, not an absolute position, so you don't need to add the position of the object itself. (See http://lslwiki.net/lslwiki/wakka.php?wakka=llSitTarget.)
Okiphia Rayna
DemonEye Benefactor
Join date: 22 Sep 2007
Posts: 2,103
12-08-2007 19:32
From: Qie Niangao
The vector argument to llSitTarget is an *offset*, not an absolute position, so you don't need to add the position of the object itself. (See http://lslwiki.net/lslwiki/wakka.php?wakka=llSitTarget.)

oh yeah duhr.. I was trying other methods and such and totally forgot that llSitTarget was already the offset XD

Thankies..

Can anyone explain perhaps exactly why it did what it did? The throwing me about 50 or more meters away I mean. DOesn't seem like anything in the script would do that.
_____________________
Owner of DemonEye Designs Custom Building and Landscaping
Owner and Blogger, Okiphia's Life
http://okiphiablog.blogspot.com/
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-08-2007 23:11
From: Okiphia Rayna
oh yeah duhr.. I was trying other methods and such and totally forgot that llSitTarget was already the offset XD

Thankies..

Can anyone explain perhaps exactly why it did what it did? The throwing me about 50 or more meters away I mean. DOesn't seem like anything in the script would do that.

because it was tring to obey the input sit target... can't remember the range for those... 300m? (for axis aligned direction)
_____________________
|
| . "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...
| -
Bam Bu
Registered User
Join date: 20 Aug 2006
Posts: 8
12-09-2007 02:03
You would roughly double the x, y and z coordinate, just adding another 4 m to your doubled height. So if you were at 50, 50, 20, you would be set to go to 100, 100, 44.
Okiphia Rayna
DemonEye Benefactor
Join date: 22 Sep 2007
Posts: 2,103
12-09-2007 12:59
okies I get it now ^_^

It was offsetting me the distance that is actually the coordinates.. so if I'd been at 120,120,120 I would be sent 120m away on X Y and Z

Thanks much ^_^
_____________________
Owner of DemonEye Designs Custom Building and Landscaping
Owner and Blogger, Okiphia's Life
http://okiphiablog.blogspot.com/