Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Editing Cubey's teleporter script

Isablan Neva
Mystic
Join date: 27 Nov 2004
Posts: 2,907
11-22-2006 20:59
I am making a system of teleporters for people to go inside houses I have for sale. I did some minor adjustments to Cubey's script but when I teleport into a house, I end up bouncing all over the walls. If I recompile the script, it works for approx one time, then it's back to bouncing on walls. I've double and triple checked my coordinates and they are correct. I did edit some of the script "below the line" having to do with the hover text, but that shouldn't have effected anything else, should it?

Does the fact that I'm right at the edge of my sim have anything to do with it? I know things start a shuckin' and a jivin' at sim edges...


// HOW TO SET UP TELEPORTER:
// STEP 1. Place this teleporter, then place the target teleport chamber.


// STEP 2. Specify the total number of destinations that are to be used. Max number is no more than the destinations listed below.
integer totalDest = 1;


// STEP 3. Go to the destination chamber, write down its X, Y, and Z position, then come back and enter those values here. X and Y are the horizontal coords on your mini-map. Z is the height. For example, if your target is at Abbotts(100,54) at an altitude of 41.5 meters, enter a vector of <100, 54, 41.5>.

// NOTE: This script only permits destinations within the same sim as the teleporter.

// Enter the destinations here:
vector dest1 = <252, 30, 420>;
vector dest2 = <0.00, 0.00, 0.00>;
vector dest3 = <0.00, 0.00, 0.00>;
vector dest4 = <0.00, 0.00, 0.00>;


// STEP 4. Replace name of destinations with a short name. Example: "second floor".
string dest1_name = "Go Inside";
string dest2_name = "REPLACE THIS WITH A DESTINATION NAME";
string dest3_name = "REPLACE THIS WITH A DESTINATION NAME";
string dest4_name = "REPLACE THIS WITH A DESTINATION NAME";



// STEP 5. Replace description of destinations with a short description. These will appear when the user clicks the button. Example: "living room and private bar".
string dest1_desc = "Modern Sky House";
string dest2_desc = "REPLACE THIS WITH A DESTINATION DESCRIPTION";
string dest3_desc = "REPLACE THIS WITH A DESTINATION DESCRIPTION";
string dest4_desc = "REPLACE THIS WITH A DESTINATION DESCRIPTION";


// STEP 6. Done! Now test it.











// ------------------------- NO NEED TO MODIFY ANYTHING BELOW THIS LINE -------------------------
integer currentDestNum = 1;
vector currentDest;
string currentDestName;
string currentDestDesc;


rotate_to_zero()
{
llSetRot(<0,0,0,0>;);
}

setDestination()
{
if (currentDestNum == 1)
{
currentDest = dest1;
currentDestName = dest1_name;
currentDestDesc = dest1_desc;
}
else if (currentDestNum == 2)
{
currentDest = dest2;
currentDestName = dest2_name;
currentDestDesc = dest2_desc;
}
else if (currentDestNum == 3)
{
currentDest = dest3;
currentDestName = dest3_name;
currentDestDesc = dest3_desc;
}
else if (currentDestNum == 4)
{
currentDest = dest4;
currentDestName = dest4_name;
currentDestDesc = dest4_desc;
}

vector pos = llGetPos();
vector offset = currentDest - pos;

llSitTarget(offset, ZERO_ROTATION);

string hoverText = "TELEPORT TO:\n"+currentDestName+"\n"+currentDestDesc+"\n\n";
llSetText(hoverText,<0,1,0>,1);
}

default
{
state_entry()
{
rotate_to_zero();
setDestination();
llSetSitText("Teleport";);
}
on_rez(integer num)
{
llResetScript();
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
llMessageLinked(LINK_SET, 0, "teleporting", "";);
llUnSit(llAvatarOnSitTarget());
}
}
}
touch_start(integer total_number)
{
currentDestNum += 1;
if (currentDestNum > totalDest) currentDestNum = 1;
rotate_to_zero();
setDestination();
}
}
_____________________

http://slurl.com/secondlife/TheBotanicalGardens/207/30/420/
Trevor Langdon
Second Life Resident
Join date: 20 Oct 2004
Posts: 149
11-22-2006 23:40
Isablan--

As Jesse Barnett mentioned in this thread
/54/1d/150295/1.html#post1340806

Try adding an
CODE

llSleep(0.5)

just above the
CODE

llUnSit(llAvatarOnSitTarget());

in your code. This should stop any momentum you have before you stand.


Also, to make the script code more readable, you should use the
php and /php tags surrounded with brackets [] to have the script code formated as PHP (much easier reading than as plain text).
Isablan Neva
Mystic
Join date: 27 Nov 2004
Posts: 2,907
11-23-2006 08:19
From: Trevor Langdon
Isablan--

Also, to make the script code more readable, you should use the
php and /php tags surrounded with brackets [] to have the script code formated as PHP (much easier reading than as plain text).



Thank you, Trevor. Does the above reference using a script in a post or are you talking about the actual script? Should I put those PHP indicators at the start and end of the script?
_____________________

http://slurl.com/secondlife/TheBotanicalGardens/207/30/420/
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
11-23-2006 08:24
Considering that this method uses llSitTarget, you can expect rendering issues and other such things to go bonkers if your teleport target is father out than your draw distance (in Graphics under Preferences). The problem is not related to 'momentum,' so to speak, because your avatar doesn't move physically. The reason that injecting llSleep() in works sometimes is because it gives your client a little bit longer to attempt to render what's happening without wonking out on you.

Solutions: Turn up your draw distance to 320, use a different teleporting method (such as WarpPos), or place things closer to the teleporters.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2006 08:39
From: Tyken Hightower
Considering that this method uses llSitTarget, you can expect rendering issues and other such things to go bonkers if your teleport target is father out than your draw distance (in Graphics under Preferences). The problem is not related to 'momentum,' so to speak, because your avatar doesn't move physically. The reason that injecting llSleep() in works sometimes is because it gives your client a little bit longer to attempt to render what's happening without wonking out on you.

Solutions: Turn up your draw distance to 320, use a different teleporting method (such as WarpPos), or place things closer to the teleporters.


errrrrrr Draw distance has nothing to do with the problem. And putting in llSleep has nothing to do with rendering.
_____________________
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
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
11-23-2006 08:47
From: Jesse Barnett
errrrrrr Draw distance has nothing to do with the problem. And putting in llSleep has nothing to do with rendering.


Considering his description of the problem, it sounds like draw distance is the likely culprit. But there's no 'momentum' involved.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2006 09:17
From: Tyken Hightower
Considering his description of the problem, it sounds like draw distance is the likely culprit. But there's no 'momentum' involved.


We do have momentum in SL because of the Havok engine. Do a teleport hack and check velocity during transit.
_____________________
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
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
11-23-2006 09:20
From: Jesse Barnett
We do have momentum in SL because of the Havok engine. Do a teleport hack and check velocity during transit.

Even so, the standard cause of failure or other problems with things that use a large sit target is draw distance. It'll cause you to sometimes get stuck, bounce around, go to the wrong place, all sorts of fun stuff.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2006 09:38
Have a Happy and safe Thanksgiving Tyken
_____________________
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
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
11-23-2006 09:43
From: Jesse Barnett
Have a Happy and safe Thanksgiving Tyken

I'm assuming this was posted with a "we can argue all day but that doesn't mean I have to care about your point" intention, so I'll just take it at face value and wish you happy Thanksgiving too. :p
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2006 10:18
From: Tyken Hightower
I'm assuming this was posted with a "we can argue all day but that doesn't mean I have to care about your point" intention, so I'll just take it at face value and wish you happy Thanksgiving too. :p

Ah definitely take it at face value. Nothing facetious in it. Four whole days to play here and with RL freinds and hope everyone enjoys thier break.

Fortunately in scripting it is usually always possible to prove a thereom. I probably will not have that chance today. A new beta is out and I will go and see if I can find any bugs. Whenever I do have time though, I'll setup some experiments and then post the data. God knows I have been wrong before, and then at other times I have been right. The fun part is trying to prove it either way.

EDIT: I am really not very good at words. Think this response still seems kind of cold and didn't mean it to be. Tyken, you and I both responded to the OP trying to be helpful which is always, always nice. Just because two people have differences of opinion does not indicate animosity. I hope to see many more posts by you here and love to hear different opinions.
_____________________
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
Isablan Neva
Mystic
Join date: 27 Nov 2004
Posts: 2,907
11-23-2006 14:00
I doubt draw distance has anything to do with it this time, I'm teleporting an avatar around 8 m - a VERY short distance. I almost wonder if because the distance is so short, the speed of the movement is what is throwing things off.

Back to my other question, the PHP stuff is relating to posts, not scripting? Correct?
_____________________

http://slurl.com/secondlife/TheBotanicalGardens/207/30/420/
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-23-2006 14:24
From: Isablan Neva
Back to my other question, the PHP stuff is relating to posts, not scripting? Correct?

Correct, by putting PHP in brackets at the start and /PHP in brackets at the end, the script you posted would have looked like this:
(I through in some indents for readability)
CODE

// HOW TO SET UP TELEPORTER:
// STEP 1. Place this teleporter, then place the target teleport chamber.

// STEP 2. Specify the total number of destinations that are to be used. Max number is no more than the destinations listed below.
integer totalDest = 1;

// STEP 3. Go to the destination chamber, write down its X, Y, and Z position, then come back and enter those values here. X and Y are the horizontal coords on your mini-map. Z is the height. For example, if your target is at Abbotts(100,54) at an altitude of 41.5 meters, enter a vector of <100, 54, 41.5>.

// NOTE: This script only permits destinations within the same sim as the teleporter.

// Enter the destinations here:
vector dest1 = <252, 30, 420>;
vector dest2 = <0.00, 0.00, 0.00>;
vector dest3 = <0.00, 0.00, 0.00>;
vector dest4 = <0.00, 0.00, 0.00>;


// STEP 4. Replace name of destinations with a short name. Example: "second floor".
string dest1_name = "Go Inside";
string dest2_name = "REPLACE THIS WITH A DESTINATION NAME";
string dest3_name = "REPLACE THIS WITH A DESTINATION NAME";
string dest4_name = "REPLACE THIS WITH A DESTINATION NAME";



// STEP 5. Replace description of destinations with a short description. These will appear when the user clicks the button. Example: "living room and private bar".
string dest1_desc = "Modern Sky House";
string dest2_desc = "REPLACE THIS WITH A DESTINATION DESCRIPTION";
string dest3_desc = "REPLACE THIS WITH A DESTINATION DESCRIPTION";
string dest4_desc = "REPLACE THIS WITH A DESTINATION DESCRIPTION";


// STEP 6. Done! Now test it.


// ------------------------- NO NEED TO MODIFY ANYTHING BELOW THIS LINE -------------------------
integer currentDestNum = 1;
vector currentDest;
string currentDestName;
string currentDestDesc;


rotate_to_zero()
{
llSetRot(<0,0,0,0>);
}

setDestination()
{
if (currentDestNum == 1)
{
currentDest = dest1;
currentDestName = dest1_name;
currentDestDesc = dest1_desc;
}
else if (currentDestNum == 2)
{
currentDest = dest2;
currentDestName = dest2_name;
currentDestDesc = dest2_desc;
}
else if (currentDestNum == 3)
{
currentDest = dest3;
currentDestName = dest3_name;
currentDestDesc = dest3_desc;
}
else if (currentDestNum == 4)
{
currentDest = dest4;
currentDestName = dest4_name;
currentDestDesc = dest4_desc;
}
vector pos = llGetPos();
vector offset = currentDest - pos;
llSitTarget(offset, ZERO_ROTATION);
string hoverText = "TELEPORT TO:\n"+currentDestName+"\n"+currentDestDesc+"\n\n";
llSetText(hoverText,<0,1,0>,1);
}

default
{
state_entry()
{
rotate_to_zero();
setDestination();
llSetSitText("Teleport");
}
on_rez(integer num)
{
llResetScript();
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
llMessageLinked(LINK_SET, 0, "teleporting", "");
llSleep(0.5);
llUnSit(llAvatarOnSitTarget());
}
}
}
touch_start(integer total_number)
{
currentDestNum += 1;
if (currentDestNum > totalDest) currentDestNum = 1;
rotate_to_zero();
setDestination();
}
}

EDIT: You will also notice I threw the sleep in there. It might even be necessary to increase to 1.0. Let us know how it works now.
_____________________
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
Isablan Neva
Mystic
Join date: 27 Nov 2004
Posts: 2,907
11-23-2006 14:34
Yay! That seems to have done the trick! Thank you!
_____________________

http://slurl.com/secondlife/TheBotanicalGardens/207/30/420/
Trevor Langdon
Second Life Resident
Join date: 20 Oct 2004
Posts: 149
11-25-2006 00:22
Jesse--
Thanks for chiming in and clearing up the PHP tag question.

Isablan--
Glad the llSleep() did the trick. Sorry for the lack of clarification concerning the use of the PHP tags (I was away for the Turkey Day holiday :) )

--Trevor

p.s. Jesse, that reminds me that I need to add the llSleep() to my teleporter code (sure hate when I forget to get out of Run Mode before using the thing, lol). It's a great tip.