Simple Teleporter not now working :(
|
|
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
|
06-04-2009 13:06
Can anyone tell me why this simple short-range teleport script, which worked fine on my old sim a few months ago, does not work on the new sim I got? By 'not work' I mean I end up at a completely different destination to the target. //replace the three numbers in following line with the target coordinates vector target=<41.0, 136.0, 29.0>;
vector offset;
default { on_rez(integer params) { offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot()); llSitTarget(offset, ZERO_ROTATION); }
state_entry() { offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot()); llSetText("Baths",<0.875,0.746,0.547>,1); llSetSitText("Teleport"); llSitTarget(offset, ZERO_ROTATION); }
changed(integer change) { // something changed if (change & CHANGED_LINK) { // and it was a link change llSleep(0.5); // llUnSit works better with this delay if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me llUnSit(llAvatarOnSitTarget()); // unsit him } } } touch_start(integer i) { llSay(0, "Please right-click and select Teleport"); } }
TIA Rock
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
06-04-2009 16:14
First ... Is <41.0, 136.0, 29.0> the location of the target in your new sim or the old one? If you didn't change the target coordinates, you'll end up at the wrong spot. Then ... is the new target more than 300m from the place where your teleporter is? If so, you're exceeding the distance for which llSitTarget will work. Usually that's not a problem if you are teleporting within the same sim, but if you are trying to go from one sim corner to an opposite one, your device won't do it.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
|
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
|
06-05-2009 00:28
From: Rolig Loon First ... Is <41.0, 136.0, 29.0> the location of the target in your new sim or the old one? If you didn't change the target coordinates, you'll end up at the wrong spot. Then ... is the new target more than 300m from the place where your teleporter is? If so, you're exceeding the distance for which llSitTarget will work. Usually that's not a problem if you are teleporting within the same sim, but if you are trying to go from one sim corner to an opposite one, your device won't do it. <41.0, 136.0, 29.0> is the location of the target in my new sim, all my teleports are on the ground only, and there are no corner-to-corner teleports, so none are more than 256 m, which was the same case in my old sim. I have a large Palace complex (200m x 200m, centrally located, three floors), and teleporting is the quickest way to get around the complex. After I rezzed the Palace (complete with the teleport orbs on the walls, not linked) I went to every teleport destination (target), noted the coords, then reprogrammed all the orb scripts with the new target locations. Not one teleporter sends me to the correct location, they are way, way off. I could post a start location, the destination target, and where I actually end up, if it will help. I am just so confused that a system that worked perfectly a couple of months back, no longer works. Rock
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
06-05-2009 01:01
One gotcha with that script is that it only sets up its target at rez and reset time. If you move or rotate the prim, you have to reset the script to recalibrate it. For convenience you could move the sit target stuff to a function, then also call it after each changed event so at least it works right on the second try, maybe in the touch_start too.
|
|
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
|
06-05-2009 01:11
From: Viktoria Dovgal One gotcha with that script is that it only sets up its target at rez and reset time. If you move or rotate the prim, you have to reset the script to recalibrate it. For convenience you could move the sit target stuff to a function, then also call it after each changed event so at least it works right on the second try, maybe in the touch_start too. Thanks, I shall try resetting the scripts to see if that helps. Of course, the teleport scripts had the old coords in them before I updated them with the new targets. I made the assumption that then saving the script also resets it too? But an explicit reset can't harm. Rock
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
06-05-2009 01:18
Yeah, if the prims didn't move or turn after you recompiled, it _should_ have been OK, I even stuck what you posted in a prim just so I didn't have to trust my eyes, and it seemed to be working fine.
You don't have any large sculpties in the area or anything like that, by any chance? That would be another possibility, that something's collision shape is pushing the avatar away from its target at unsit time. You could try a few seconds' sleep before the llUnsit to help rule out that kind of weirdness.
|
|
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
|
06-05-2009 02:12
From: Viktoria Dovgal Yeah, if the prims didn't move or turn after you recompiled, it _should_ have been OK, I even stuck what you posted in a prim just so I didn't have to trust my eyes, and it seemed to be working fine.
You don't have any large sculpties in the area or anything like that, by any chance? That would be another possibility, that something's collision shape is pushing the avatar away from its target at unsit time. You could try a few seconds' sleep before the llUnsit to help rule out that kind of weirdness. No, no scuplties anywhere. I am at work now, but when I get home in 5 hours time I will do three specific tests, 3 x a reset of the script, followed by a note of my current location, the target location, and the actual place I am delivered to, from three different start locations, to three different target locations. Rock
|
|
Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
|
06-05-2009 13:39
It WAS a simple matter of resetting the scripts Viktoria!
Many thanks for that. Seems I was wrong in my assumption that opening a script, modifying it, and saving it, resets it as well.
Soon as I reset all my scripts they all worked normally.
Thanks Again,
Rock
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
06-05-2009 13:51
From: Rock Vacirca Many thanks for that. Seems I was wrong in my assumption that opening a script, modifying it, and saving it, resets it as well. Err.. If recompiling a script doesn't reset it, there's something very, VERY wrong. A recompile should absolutely reset it.
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
06-05-2009 14:52
It's way too easy to forget to do things in a certain order when there are the usual real life and in world distractions. At some point I got tired of forgetting and rewrote all mine to poll every few minutes  It would be nice if the moving_* events could pick up on stuff like that reliably.
|