Table of Contents

Shortnote

This script was tested and works on OpenSim version 0.7.4!

The code below uses OSSL functions to teleport an agent to a different link-ed grid. The script assumes that the destination grid is to be found at 8000x7998 on the map. It is an off-spin of the example provided by the OpenSim OSSL API for the osTeleportAgent function. The difference is that this script uses state isolation to prevent an accidental double-click of the primitive which may result in a viewer crash.

Setup

In order to change the script and tailor to your needs you will have to edit the following lines in the script in the Code section:

        ////////////////////////////////////////  
        // Region name.
        // Nova is on separate grid now.
        // string Destination = "Nova";
        // Landing point, in local coordinates.
        vector landingPoint = <182, 225, 26>;
        // Look-At when they arrive.
        vector lookAt = <1,1,1>;
        // The global x coordinate of the map tile
        integer map_x = 5000;
        integer map_y = 5000;
        ////////////////////////////////////////

to set the landingPoint on the destination grid in local coordinates. Most of the time, the lookAt directional vector can be left as is, unless you have a custom application that requires the agent to rotate and look at a certain point upon arrival.

The map_x and map_y variables have to change to the global map tile coordinates where the simulator is located. The following is an example of a grid with three simulators:

To find out the simulator you wish to teleport the agents to, by going right on the map you have to add 1 from where you count. Going left, you have to subtract 1. If you go up, you will have to add 1 and going down is subtracting 1.

On OpenSim, all global coordinates can be found out by looking at the Regions.ini file.

Code

hypergrid_teleport_opensim.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
// This is a spin off the example osTeleportAgent
// example which you can find on he OpenSim site at: 
// http://opensimulator.org/wiki/OsTeleportAgent
// The latest version can be found at:
// http://grimore.org/opensim:hypergrid_teleports
 
key avatar = NULL_KEY;
 
default
{
    touch_start(integer num_detected) {
        avatar = llDetectedKey(0);
        state teleport;
    }
}
 
state teleport
{
    state_entry() {
        ////////////// SETTINGS ////////////////
        ////////////////////////////////////////  
        // Region name.
        // Nova is on separate grid now.
        // string Destination = "Nova";
        // Landing point, in local coordinates.
        vector landingPoint = <182, 225, 26>;
        // Look-At when they arrive.
        vector lookAt = <1,1,1>;
        // The global x coordinate of the map tile
        integer map_x = 5000;
        integer map_y = 5000;
        ////////////////////////////////////////
 
        osTeleportAgent(avatar, map_x, map_y, landingPoint, lookAt);
        state default;
    }
}

opensim/hypergrid_teleports.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.