Jump to content
Nika Talaj

Your personal rez zone

Recommended Posts

If you like to go boating/sailing, and you live in a region that has water but no rez zone, or it's far away, the script below may help.  It teleports you and your boat from your yard to the water.  Here's the process to use it:

1.  Rez your boat in your yard.  If it goes physical and falls over, ignore that.

2.  Figure out where you'd like the boat to go (location and rotation IN YOUR REGION), and put that into the description field of the boat.  See script header for format.

3. Put the script into the boat's inventory.

4.  Sit in the boat, as usual.  As soon as you sit, it will immediately go to the location you set.  The script then deletes itself, after blanking out the description.

Just for kicks, you can limit this teleport function to happening for owner only, group, or everyone.  Info on how to config that, and other details, are in the script header.

For my house in Foxbridge, I made a copy of my boat that has a nearby water location already in the description, and the script already in the boat.  Whenever I want to sail, I just rez it in my backyard and sit on it.  I'm in the water, hoist sail and go!

Obviously this won't work if your boat already has some sort of config info in the description.   I tested a BWind engine Bandit, and a Trudeau boat, and both were OK.

I hesitated to post this, thinking it could be used to grief people.  But it isn't any different from any other teleport script, so here goes.  I stripped down a more general-purpose script to make this, so if there are a couple of lines that are just plain extra, don't fret.

Edited this to put the script in a "code" section (thanks Quartz!).  Also cleaned up comments, removed unused leftover code, and retested.  Function is the same as when I originally posted (last night).  This was written so that newer coders can hopefully modify it easily.  To any code warriors out there who are offended by neglected opportunities to minimize bytecode size ...  lol move on, nothing to see here!

Editing again to add: If you'd like to try it but have never made a new script, you can pick up a copy on the porch at  http://maps.secondlife.com/secondlife/Foxbridge/213/108/23    It's a blue box with a rotating texture for sale for 0L$.

// Boat Teleporter

// Point-to-point teleport of an avatar sitting on an object, generally a boat.  Does not unsit
// after arrival.  Destination position & rotation in object description.  Script deletes itself
// after a single use.

//----------------------------------
// Setup:
// 1. Change boat description (under name in General tab on Build/Edit menu).
//   See format below.

// 2. Put script in boat.  Your boat is now a single-use teleporter.  When you sit, it will
//    immediately go to the destination you've configured, and then the boat description will be set
//    to an empty string and the script will delete itself.
//     You should see the destination echoed in chat.

// 3. Sit on the boat.  It should immediately move to the destination.

// Description format:
// <destination position x, y, z>; <destination rotation Euler (from the build menu) x, y, z> ; Access

// Where "Access" = A for all, O for owner, G for group.  If missing, defaults to group

// Example Description: 
//  <189, 174, 20.25>; <0, 0, 349.5>; A

// Note that Bellisseria water is at 20m; I set Z to 20.25 just to avoid any possibility of collision.
// You can use the list ALWAYS to hard-code a list of avatar UUIDs to always permit to use,
// regardless of their group.  I've set a hopefully harmless one below, just to show how.

// If there is a hill between the starting point and the destination, your avatar may collide
// with that land, making the boat land in the wrong place.  If this happens, set the variable
// JUMP to some value like 20.
// All this does is move you 20m vertically before teleporting to your destination; that will
// probably be adequate to avoid the collision.

// You cannot set the destination to 0,0,0
// The destination can be anywhere within the region, up to 4096m high
// Whenever you change the description/position, must reset script

// There is little error checking on setting the destination; if you just type in text
// instead of x,y,z the script will detect it and give you an error, but if you type in
// 139,0;10023 you will end up lost when you TP.

// If the boat is moved before you get in, it's OK, it will automatically recalculate the TP target.

// ---- Globals ------------------------------

vector targetPos;
rotation targetRot;
string access;    // A for all, O for owner, G for group.  null = G.

integer JUMP = 0;    // set to number of meters to go vertical before TPing

// Ebbe Linden, Quartz Mole
list ALWAYS = ["24603c24-cfe6-4adc-9965-6da2df2d7c08", "efd3d802-701d-48f0-93ab-fce050e6f2ac"];

// ---- SUBROUTINES ------------------------------
// -----------------------------------------------

rotation NormRot(rotation Q)
{
    float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s);
    return <Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>;
}

// -----------------------------------------------

reset()     //sets target position etc
{

    list scrat;

                        // Parse object description
    scrat = llParseString2List(llGetObjectDesc(),[";"],[]);  // position vector; rot vector; access
    access = llStringTrim(llToUpper(llList2String(scrat, 2)), STRING_TRIM);
    if (access == "") access = "G";            // default to group access
    
    targetPos = (vector)llStringTrim(llList2String(scrat, 0), STRING_TRIM);

    targetRot = NormRot(llEuler2Rot((vector)llStringTrim(llList2String(scrat, 1), STRING_TRIM) * DEG_TO_RAD ) );
    llSay(0, "Target: " + (string)targetPos + ", rotation: " + (string)targetRot);

    if (targetPos == ZERO_VECTOR) {   // user probably typed in a text desc
        targetPos = llGetPos();
        llSay(0, "Bad destination in object description: use format x,y,z");
    }


} // endreset

default
{
    state_entry()
    {
        reset();
    }

    on_rez(integer startup_param)
    {
        llResetScript();
    }

    changed(integer change)
    {
        integer success;
        key whosat;
        integer ok;

        if (change & CHANGED_LINK)
        {
            whosat = llAvatarOnSitTarget();
            if (whosat != NULL_KEY)
            {
                ok = FALSE;
                if (access == "A")
                    ok = TRUE;
                else if (llListFindList(ALWAYS, [(string)whosat])!= -1)
                    ok = TRUE;
                else if ((access == "O") && (whosat == llGetOwner()) )
                    ok = TRUE;
                else if ((access == "G") && llSameGroup(whosat) )
                    ok = TRUE;

                    // if avie doesn't have access, just wait for next sit
                if  (ok) {    // agent has access to teleport script

                    if (JUMP) {
                        llSetPos(targetPos + <0,0, JUMP>);
                        llSleep(5.0);
                    }
                    
                    success = llSetRegionPos(targetPos);
                    llSetRot(targetRot);

                    if (!success)
                        llSay(0, "Move unsuccessful, check destination.");
            
                    // either way, reset description & delete script
                    llSetObjectDesc("");
                    llRemoveInventory( llGetScriptName() ); // delete this script

                } else
                    llSay(0, "Sorry, you do not have access to the boat teleporter");


            }  // end of avatar sat

        }
        else  if (!(change & CHANGED_COLOR)) //some other prim change event
        {
            reset();
        }
    } // end changed event

    moving_end()
    {
        reset();            // try to compensate for object movement
    }

}  // end default

 

Edited by Nika Talaj
note about box
  • Like 8
  • Thanks 20
  • Confused 1

Share this post


Link to post
Share on other sites
4 hours ago, Nika Talaj said:

If there is a special way to post code in these forums, feel free to tell me.

Click the code button, <>,  in the bar above the box where you type, and then copy-paste your code into the window that appears:

38cba8317f61c4e19f583e860c358b70.png

It's maybe worth noting that the function llSetRegionPos, which this script uses,  will move the object to a position on the same region as which you start (or 10 metres over the border, I think).   So you can use it to "teleport" the object round your region but you can't move to a coastal region from a landlocked one.    (You know this, obviously, Nika, but other readers might not).

  • Like 4
  • Thanks 9

Share this post


Link to post
Share on other sites

Thanks @Quartz Mole!  I cleaned the post up a bit. 

If anyone finds this useful, please post here.  If enough do, I'll give it to the Bellisserian folks to add to their freebies.

If you'd like to try it but have never made a new script, you can pick up a copy on the porch at  http://maps.secondlife.com/secondlife/Foxbridge/213/108/23    It's a blue box with a rotating texture for sale for 0L$.  (Feel free to poke around if you'd like, but there's nothing at all striking about our place - it's just our comfy beach house.)   Also, please make sure you have enough available LI before you rez your boat on your parcel!  Most boats are about 32, but we all have access to premium sandboxes, which would be a great place to just try using the script.

There is no magic to finding the position & rotation you want for your boat.  Just rez it and move it using edit to where you want it.  Then copy the position & rotation to chat to save them, delete the boat (it'll probably poof as soon as you take it out of edit) and go back and set one up on your land.  [Note: in Firestorm, you will see on the object tab of the build menu these tiny little buttons with a "c" or "p" in them next to the position and rotation fields.  If you hit a "c" one, it will copy the position or rotation into your clipboard as a vector, that is, in the exact format you need for this script].

 

Edited by Nika Talaj
  • Like 3
  • Thanks 2

Share this post


Link to post
Share on other sites

Hi, this worked great!  I used the script from your porch, put it in a Yachtline 420 boat, and it zipped right to the spot.  The only flailing around was operator error, I kept trying to re-use the boat that was freshly "returned" in my inventory and could not figure out why the TP script went away, then re-read your explanation and saw that it automatically deletes itself LOL.  Thanks so much for providing this :)

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
20 hours ago, Nika Talaj said:

If you like to go boating/sailing, and you live in a region that has water but no rez zone, or it's far away, the script below may help.  It teleports you and your boat from your yard to the water.  Here's the process to use it:

1.  Rez your boat in your yard.  If it goes physical and falls over, ignore that.

2.  Figure out where you'd like the boat to go (location and rotation IN YOUR REGION), and put that into the description field of the boat.  See script header for format.

3. Put the script into the boat's inventory.

4.  Sit in the boat, as usual.  As soon as you sit, it will immediately go to the location you set.  The script then deletes itself, after blanking out the description.

Just for kicks, you can limit this teleport function to happening for owner only, group, or everyone.  Info on how to config that, and other details, are in the script header.

For my house in Foxbridge, I made a copy of my boat that has a nearby water location already in the description, and the script already in the boat.  Whenever I want to sail, I just rez it in my backyard and sit on it.  I'm in the water, hoist sail and go!

Obviously this won't work if your boat already has some sort of config info in the description.   I tested a BWind engine Bandit, and a Trudeau boat, and both were OK.

I hesitated to post this, thinking it could be used to grief people.  But it isn't any different from any other teleport script, so here goes.  I stripped down a more general-purpose script to make this, so if there are a couple of lines that are just plain extra, don't fret.

Edited this to put the script in a "code" section (thanks Quartz!).  Also cleaned up comments, removed unused leftover code, and retested.  Function is the same as when I originally posted (last night).  This was written so that newer coders can hopefully modify it easily.  To any code warriors out there who are offended by neglected opportunities to minimize bytecode size ...  lol move on, nothing to see here!

Editing again to add: If you'd like to try it but have never made a new script, you can pick up a copy on the porch at  http://maps.secondlife.com/secondlife/Foxbridge/213/108/23    It's a blue box with a rotating texture for sale for 0L$.


// Boat Teleporter

// Point-to-point teleport of an avatar sitting on an object, generally a boat.  Does not unsit
// after arrival.  Destination position & rotation in object description.  Script deletes itself
// after a single use.

//----------------------------------
// Setup:
// 1. Change boat description (under name in General tab on Build/Edit menu).
//   See format below.

// 2. Put script in boat.  Your boat is now a single-use teleporter.  When you sit, it will
//    immediately go to the destination you've configured, and then the boat description will be set
//    to an empty string and the script will delete itself.
//     You should see the destination echoed in chat.

// 3. Sit on the boat.  It should immediately move to the destination.

// Description format:
// <destination position x, y, z>; <destination rotation Euler (from the build menu) x, y, z> ; Access

// Where "Access" = A for all, O for owner, G for group.  If missing, defaults to group

// Example Description: 
//  <189, 174, 20.25>; <0, 0, 349.5>; A

// Note that Bellisseria water is at 20m; I set Z to 20.25 just to avoid any possibility of collision.
// You can use the list ALWAYS to hard-code a list of avatar UUIDs to always permit to use,
// regardless of their group.  I've set a hopefully harmless one below, just to show how.

// If there is a hill between the starting point and the destination, your avatar may collide
// with that land, making the boat land in the wrong place.  If this happens, set the variable
// JUMP to some value like 20.
// All this does is move you 20m vertically before teleporting to your destination; that will
// probably be adequate to avoid the collision.

// You cannot set the destination to 0,0,0
// The destination can be anywhere within the region, up to 4096m high
// Whenever you change the description/position, must reset script

// There is little error checking on setting the destination; if you just type in text
// instead of x,y,z the script will detect it and give you an error, but if you type in
// 139,0;10023 you will end up lost when you TP.

// If the boat is moved before you get in, it's OK, it will automatically recalculate the TP target.

// ---- Globals ------------------------------

vector targetPos;
rotation targetRot;
string access;    // A for all, O for owner, G for group.  null = G.

integer JUMP = 0;    // set to number of meters to go vertical before TPing

// Ebbe Linden, Quartz Mole
list ALWAYS = ["24603c24-cfe6-4adc-9965-6da2df2d7c08", "efd3d802-701d-48f0-93ab-fce050e6f2ac"];

// ---- SUBROUTINES ------------------------------
// -----------------------------------------------

rotation NormRot(rotation Q)
{
    float MagQ = llSqrt(Q.x*Q.x + Q.y*Q.y +Q.z*Q.z + Q.s*Q.s);
    return <Q.x/MagQ, Q.y/MagQ, Q.z/MagQ, Q.s/MagQ>;
}

// -----------------------------------------------

reset()     //sets target position etc
{

    list scrat;

                        // Parse object description
    scrat = llParseString2List(llGetObjectDesc(),[";"],[]);  // position vector; rot vector; access
    access = llStringTrim(llToUpper(llList2String(scrat, 2)), STRING_TRIM);
    if (access == "") access = "G";            // default to group access
    
    targetPos = (vector)llStringTrim(llList2String(scrat, 0), STRING_TRIM);

    targetRot = NormRot(llEuler2Rot((vector)llStringTrim(llList2String(scrat, 1), STRING_TRIM) * DEG_TO_RAD ) );
    llSay(0, "Target: " + (string)targetPos + ", rotation: " + (string)targetRot);

    if (targetPos == ZERO_VECTOR) {   // user probably typed in a text desc
        targetPos = llGetPos();
        llSay(0, "Bad destination in object description: use format x,y,z");
    }


} // endreset

default
{
    state_entry()
    {
        reset();
    }

    on_rez(integer startup_param)
    {
        llResetScript();
    }

    changed(integer change)
    {
        integer success;
        key whosat;
        integer ok;

        if (change & CHANGED_LINK)
        {
            whosat = llAvatarOnSitTarget();
            if (whosat != NULL_KEY)
            {
                ok = FALSE;
                if (access == "A")
                    ok = TRUE;
                else if (llListFindList(ALWAYS, [(string)whosat])!= -1)
                    ok = TRUE;
                else if ((access == "O") && (whosat == llGetOwner()) )
                    ok = TRUE;
                else if ((access == "G") && llSameGroup(whosat) )
                    ok = TRUE;

                    // if avie doesn't have access, just wait for next sit
                if  (ok) {    // agent has access to teleport script

                    if (JUMP) {
                        llSetPos(targetPos + <0,0, JUMP>);
                        llSleep(5.0);
                    }
                    
                    success = llSetRegionPos(targetPos);
                    llSetRot(targetRot);

                    if (!success)
                        llSay(0, "Move unsuccessful, check destination.");
            
                    // either way, reset description & delete script
                    llSetObjectDesc("");
                    llRemoveInventory( llGetScriptName() ); // delete this script

                } else
                    llSay(0, "Sorry, you do not have access to the boat teleporter");


            }  // end of avatar sat

        }
        else  if (!(change & CHANGED_COLOR)) //some other prim change event
        {
            reset();
        }
    } // end changed event

    moving_end()
    {
        reset();            // try to compensate for object movement
    }

}  // end default

 

I wonder if you could use the same thing for a car or an animal, but usually they aren't on mod.

Share this post


Link to post
Share on other sites
1 hour ago, Prokofy Neva said:

I wonder if you could use the same thing for a car or an animal, but usually they aren't on mod.

Sure you can.

I have an alternative system, but it only works for properties right on the water but separated by a strip of Linden beach. It extends a temporary track from the boat storage rack out into the water. Then the boat can slide down the track. When not in use, the track retracts back onto your own property. I want to improve it so it has a boat trailer like thing that carries the boat. These are called "marine railways" in real life.

marinerailwayfullmed.thumb.jpg.dfeaf16678a35309674349a868e37116.jpg

Just have to cross that narrow strip of Linden beach...

  • Like 3

Share this post


Link to post
Share on other sites
5 hours ago, Prokofy Neva said:

I wonder if you could use the same thing for a car or an animal, but usually they aren't on mod.

For a car, definitely, use the same script in the same way.  For an animal, remember, this script triggers when an avatar sits on the object.  So I guess it depends what sort of animal!

Rideable camel ... oh yes.   Squirrel ... not so much. 😊

  • Like 2

Share this post


Link to post
Share on other sites
On 9/2/2019 at 10:47 AM, Malayaa said:

Hi, this worked great!  I used the script from your porch, put it in a Yachtline 420 boat, and it zipped right to the spot.  The only flailing around was operator error, I kept trying to re-use the boat that was freshly "returned" in my inventory and could not figure out why the TP script went away, then re-read your explanation and saw that it automatically deletes itself LOL.  Thanks so much for providing this :)

You may want to consider this little tool. I can see that rezzer and this "personal rez zone" script working together in pure awesome solidarity!

https://marketplace.secondlife.com/p/Vehicle-Sensor-Rezzer/17967895

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites
On 9/2/2019 at 2:00 PM, Nika Talaj said:

If anyone finds this useful, please post here.  If enough do, I'll give it to the Bellisserian folks to add to their freebies.

It is very useful. Even though my house is very close to the water, I think that now, using the script, it's easier to just rezz and ride rather than rezz, sit and drag it into the water. I'm using it all the time.

I also tested in a place farther from my house, in same region, and it worked perfectly.

Thank you so much for sharing this!

15f76f6f75e26dc2cfde067e862227d5.gif

Edited by DemeraraGirl
  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

I just tested this and it works great. Now I'm able to use the canal for more than just a pretty view ;) . This is such a handy and IMHO necessary script. Anyone living near the water really should have this. 👍

Now a little off topic but still relevant; anyone have suggestions for good low LI boats? I'm currently using (TMS) Cadet - Sea Boss at 5 LI. It does serve it's purpose but just in case I feel like a change. I searched MP and came up with a few motor boats from TUFF but most others seem to be heading into double digits LI.

 

water.thumb.png.a205f2a39770252e2fb9cb92a2726727.png

EDIT:

I've probably gone a roundabout way of doing this (and I'm far from an expert when it comes to scripting so I'm sure there's an easier way to do it) but I've rezzed a model of my boat in my yard and positioned it against the fence with all the scripts and animations removed so it's basically just a prop. In the root prim of it I added an owner only rez script (so my land doesn't become cluttered with copies as I only have 9 LI left) that way when I touch the model it rezzes a driveable copy of my boat beside it. Now when I sit on it, it immediately transports me to the water's edge of the canal. Saves me having to rez a copy of the scripted version every time. (And now I feel like a bad parent. Riley doesn't have a flotation device on. Here's hoping Zooby makes one, stat! With me at the helm she'll need all the help she can get!)

Also the LM in the OP didn't work for me. I just copied the script from here and it worked fine.

Thanks again @Nika Talaj!

Edited by RaeLeeH
Added stuff. And a pic. And fixed typos. OMG >.<
  • Like 1

Share this post


Link to post
Share on other sites
28 minutes ago, RaeLeeH said:

Now a little off topic but still relevant; anyone have suggestions for good low LI boats? I'm currently using (TMS) Cadet - Sea Boss at 5 LI. It does serve it's purpose but just in case I feel like a change. I searched MP and came up with a few motor boats from TUFF but most others seem to be heading into double digits LI.

Because of the initial lack of rez zones when exploring Bellisseria I've really gotten into wearable vehicles, so easy to use. I have a wearable row boat (from What's next Gacha I think) that I can pop on any time I want to jump on the water. No LI counting required!:)

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites
On 9/3/2019 at 12:07 AM, animats said:

Sure you can.

I have an alternative system, but it only works for properties right on the water but separated by a strip of Linden beach. It extends a temporary track from the boat storage rack out into the water. Then the boat can slide down the track. When not in use, the track retracts back onto your own property. I want to improve it so it has a boat trailer like thing that carries the boat. These are called "marine railways" in real life.

marinerailwayfullmed.thumb.jpg.dfeaf16678a35309674349a868e37116.jpg

Just have to cross that narrow strip of Linden beach...

I just gave up my house that was on a canal....of course there was a grassy, rocky area between my property & the water - but I just got in the boat & made it go & I landed in the water......

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...