Jump to content
You are about to reply to a thread that has been inactive for 184 days.

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

Recommended Posts

I know I may have the wrong script, but this script is the most close thing that works for me. I want to be able to type in local chat /1 SLURLLINK and it automatically teleport me to the location. How can I achieve this?

 

string simName = "Help Island Public";
vector simGlobalCoords;
 
vector landingPoint = <128.0, 128.0, 24.0>;
 
key owner;
 
 
default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
 
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
 
    state_entry()
    {
        owner = llGetOwner();
 
        llRequestPermissions(owner, PERMISSION_TELEPORT);
        llRequestSimulatorData(simName, DATA_SIM_POS);
    }
 
    touch_start(integer total_number)
    {
        key id = llDetectedKey(0);
 
        if (id == owner)
        {
            if (simGlobalCoords == ZERO_VECTOR)
            {
                llOwnerSay("Config error, tp request was denied. Please try again!");
                llResetScript();
            }
            else
            {
                llOwnerSay("Teleporting you to: http://maps.secondlife.com/secondlife/"
                    + llEscapeURL(simName) + "/" + (string)llRound(landingPoint.x)
                    + "/" + (string)llRound(landingPoint.y) + "/" + (string)llRound(landingPoint.z) + "/");
 
                llTeleportAgentGlobalCoords(owner, simGlobalCoords, landingPoint, ZERO_VECTOR);
            }
        }
        else
        {
            // llRegionSayTo is faster than llInstantMessage and we can assume
            // that the touching avatar is within the same sim
 
            llRegionSayTo(id, PUBLIC_CHANNEL,
                "Sorry, I can't tp you. You're NOT my owner!");
        }
    }
 
    run_time_permissions(integer perm)
    {
        // if permission request has been denied (read ! as not)
        if (!(perm & PERMISSION_TELEPORT))
        {
            llOwnerSay("I need permissions to teleport you!");
            llRequestPermissions(owner, PERMISSION_TELEPORT);
        }
    }
 
// dataserver event only called if data is returned
// or in other words, if you request data for a sim that does
// not exist this event will NOT be called
 
    dataserver(key query_id, string data)
    {
        simGlobalCoords = (vector)data;
        // llOwnerSay("Sim global coords: " + (string)simGlobalCoords);
    }
}

Link to post
Share on other sites

It's possible, and this script has some of the relevant functionality, but why? You know you can just past the slurl into the addressbar of the viewer and it'll trigger the teleport without any script needed.

Also, the llTeleportAgentGlobalCoords function only works in Experience-based scripts and objects owned by the teleported avatar (except specifically temp-attached objects which are owned by the wearer but the function won't work). That's not a problem if you're just adding this functionality to an existing (non-temp-attached) HUD or something like that, but it can't be just a freestanding, unattached object to teleport anybody other than the owner. Also, it won't work if the avatar is sitting, and when it does work, it's tricky to get the avatar facing the right direction (but you may not care about that).

Anyway, if this is really what you want to do, the script will need to listen and then parse the SLURL to extract the region name, then do the llRequestSimulatorData() call for that specific region name, in contrast to the script above, which does it for a constant region name right away in state_entry. We can work on that if you want more help.

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 184 days.

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

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...