Jump to content

Teleporter 2014


Niric Moger
 Share

You are about to reply to a thread that has been inactive for 3552 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

//                  Teleport 2014
//             Written by Niric Moger
//
// Credit goes to Vincent Nacon for
// http://wiki.secondlife.com/wiki/RegionSitTeleport
// // Released into the Public Domain // Sept 2nd 2014 // // Destination Global, taken from an objects x,y,z vector at the destination // note ZERO_VECTOR or <0,0,0> will not work because that is used to test vector targetPosition = <128.0, 128.0, 72.120>; // This is invalid if skybox_mode = TRUE // Skybox Mode Globals, this gets the objects position and only sends user up or down // set skybox_mode = TRUE or skybox_mode = FALSE integer skybox_mode = FALSE; // set to TRUE if you want to only teleport up or down float height = 72.120; // set this to the ground or skybox position // Text Globals string text = ""; // optional floating text on the teleporter, input a space if not used vector text_color = <1.0,1.0,1.0>; // the floating text's color // Security Access Global integer access_mode = 1; // 1 - public; 2 - owner; 3 - group; default { state_entry() { llSetClickAction(CLICK_ACTION_SIT); // Set touch to sit this is very important for this script llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); llSetText(text,text_color,1.0); } changed(integer change) { if (change & CHANGED_LINK) { key sittingAvatar = llAvatarOnSitTarget(); integer access_granted = FALSE; if (access_mode == 1) access_granted = TRUE; else if (access_mode == 2) { if (sittingAvatar == llGetOwner()) access_granted = TRUE; else { llRegionSayTo(sittingAvatar,0," sorry, owner access only."); llUnSit(sittingAvatar); } } else if (access_mode == 3) { if (llSameGroup(sittingAvatar)) access_granted = TRUE; else { llRegionSayTo(sittingAvatar,0," sorry, group memeber access only."); llUnSit(sittingAvatar); } } if (access_granted) { if (skybox_mode == TRUE) { list details = llGetObjectDetails(sittingAvatar, ([OBJECT_NAME, OBJECT_DESC, OBJECT_POS, OBJECT_ROT, OBJECT_VELOCITY, OBJECT_OWNER, OBJECT_GROUP, OBJECT_CREATOR])); targetPosition = llList2Vector(details,2); } //Test to make sure if(llGetPos() != ZERO_VECTOR) { // Adding 0.25 to the z because that is half the size of default prim // This helps keep feet from being buried in ground targetPosition.z = height + 1.25; // destination up or down set with global variable if(sittingAvatar) { vector positionToReturnTo = llGetPos(); llSetRegionPos(targetPosition); llSleep(0.2); llUnSit(sittingAvatar); llSleep(0.2); llSetRegionPos(positionToReturnTo); } } else{llUnSit(sittingAvatar);llRegionSayTo(sittingAvatar,0," unsitting because of ZERO_VECTOR");} } } } }

 

 

 

 

Here is a script for a group/owner/public teleporter that utilizes the llSetRegionPos function.  The function llSetClickAction(CLICK_ACTION_SIT) changes the prim so when it is touched, the avatar sits on the prim, therefore eliminating the need to right click and select sit from the right click menu effectively making this a touch to teleport.  To quote LlSetClickAction's CLICK_ACTION_SIT description:"When the prim is touched, the avatar sits upon it"

To use as a regular teleporter simply build a prim on the ground where you want to land and get the object's <x,y,z> value and set the value of targetPosition to <x,y,z> of the destination prim.  Make sure skybox mode is FALSE if you are using like a regular teleporter.

I have added a Skybox mode functionality that has never been implemented as far as I know, when it is set to true it takes the position of the prim that it is in and uses that as the X and Y, while ability to set a custom Z which can be up to 4095 meters up into the sky, or set to go to the ground by taking the Z value from a prim rezzed on the ground. 

The security feature allows you to set it to public, group or private.  If you want everyone to use it set access_mode to 1.  If only you want to use it set access_mode to 2.  If you want only people to use it from your group set access_mode to 3. 

Hope this script is useful, please comment on any problems or suggestions with it.  Thanks, Niric Moger

Link to comment
Share on other sites

This is a basic sit teleporter, whether you recognize it or not.  If the avatar does not sit on the sit target, nothing happens.

The one big observation I would offer is that your changed event, as written, will be activated by any change, rather than being triggered only by CHANGED_LINK.  So it will be triggered if you add something to its inventory or change its color or size, or even if the sim restarts.  Always test if (change & CHANGED_LINK).

BTW, I don't think I have seen a WarpPos or PosJump teleporter for ages, and I doubt that they even work now. Scripters have been using llSetRegionPos since it was introduced in 2011 (I think that's the right year).  One of my favorites is Dora Gustafson's beauty, which was posted as she developed it in the forums in 2012.

Link to comment
Share on other sites


Qwalyphi Korpov wrote:

You might want to consider using the modern llRegionSayTo in place of the old llSay for messages meant only for the sitting avatar. 

llRegionSayTo has been added to the script.

Nothing bad was meant by saying I couldn’t find a decent script, I just couldn’t find one so I made one.

Link to comment
Share on other sites


Rolig Loon wrote:

This
is
a basic sit teleporter, whether you recognize it or not.  If the avatar does not sit on the sit target, nothing happens.

The one big observation I would offer is that your
changed
event, as written, will be activated by
any
change, rather than being triggered only by CHANGED_LINK.  So it will be triggered if you add something to its inventory or change its color or size, or even if the sim restarts.  Always test
if (change & CHANGED_LINK)
.

BTW, I don't think I have seen a WarpPos or PosJump teleporter for ages, and I doubt that they even work now. Scripters have been using
llSetRegionPos
s
ince it was introduced in 2011 (I think that's the right year).  One of my favorites is
, which was posted as she developed it in the forums in 2012.

You are correct it is a basic sit teleporter.  It changes the properies of the prim with llSetClickAction(CLICK_ACTION_SIT);  I have updated the description to emphasize this.

I have also updated the script to include the if (change & CHANGED_LINK).  They might want to change the example for RegionSitTeleport which is where I found the basic example for this script to also include a if (change & CHANGED_LINK)

Thank you for pointing out Dora Gustafson's beauty, I am reading this to see if anything should be added to my script to improve it.

 

Link to comment
Share on other sites


Niric Moger wrote:

[....]They might want to change the example for
which is where I found the basic example for this script to also include a
if (change & CHANGED_LINK)
.  This will save some future scripters some confusion. [ .... ]


 Ah .... that's a script on a user page, so it's up to the user, Vincent Nacon, to update it if he wishes.  It would be poor form to modify a script on someone else's user page.  In that same vein, of course, it would be poor form to base another script on Mr. Nacon's work and not cite it properly so that he gets credit.  :smileywink:

Link to comment
Share on other sites

//Test to make sure                 if(llGetPos() != ZERO_VECTOR)                {                    // Adding 0.25 to the z because that is half the size of default prim                    // This helps keep feet from being buried in ground                    targetPosition.z = height + 1.25; // destination up or down set with global variable                                    if(sittingAvatar)                    {                        vector positionToReturnTo = llGetPos();                        llSetRegionPos(targetPosition);                        llSleep(0.2);                        llUnSit(sittingAvatar);                        llSleep(0.2);                        llSetRegionPos(positionToReturnTo);                    }                }                else{llUnSit(sittingAvatar);llRegionSayTo(sittingAvatar,0,"  unsitting because of ZERO_VECTOR");}

Added a check for ZERO_VECTOR and llSleep in strategic spots to make teleport smoother after reading thread mentioned prior.

Link to comment
Share on other sites


Niric Moger wrote:

I have also updated the script to include the
if (change & CHANGED_LINK)
.  They might want to change the example for
which is where I found the basic example for this script to also include a
if (change & CHANGED_LINK)
.  This will save some future scripters some confusion. 

you can change that if you like, it is a regular wiki page and not in anyone's user space, so it is fair game to edit.

Link to comment
Share on other sites

Not snarky at all.  By federal and international copyright law, the creator of a work holds the rights to it as intellectual property. That is reinforced in SL by the TOS that we all agreed to.  Sect 2.3:"You retain any and all Intellectual Property Rights you already hold under applicable law in Content you upload, publish, and submit to or through the Servers, Websites, and other areas of the Service, subject to the rights, licenses, and other terms of this Agreement, including any underlying rights of other users or Linden Lab in Content that you may use or modify."  Giving other people the right to use your intellectual property does not give them the right to claim that it is their intellectual property.  We have discussed this principle in this forum many times. Being placed in the public domain does not alter that.  I cannot take a story by Mark Twain and claim that I wrote it even though it is in the public domain. Similarly, if someone uses a script that I wrote, I expect them to recognize that I created it.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3552 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...