ContinentDetector

From Second Life Wiki
Jump to: navigation, search

Introduction

The Second Life grid, especially the mainland parts, is organized into interesting and aesthetically-pleasing continents, with a variety of landforms and connectivities and geographies. The continents have their own histories, their own interesting places. But because so many people just teleport everywhere (kids these days, I tell ya), all too many people aren't aware of which continent they're on, or where they are relative to the continents, much of the time. This script is a simple example of how one might determine this, and thereby become more Geographically Aware, and therefore more fun at parties.

Usage

To use this script, stick it into the root prim of pretty much any object, and wear that object somewhere on your person. Whenever you teleport, or touch the object, it will tell you your global coordinates, and also what continent or other area of the grid you are on.

Limitations and Notes

In fact this script is mostly just a demonstration of llGetRegionCorner(). The division of the world into continents and other sections is strictly unofficial and approximate, the result of using the map to zip around the grid and see roughly where things seemed to start and stop. It's relatively easy to change what's there, or to add your own areas and divisions. (Is the old Teen Grid still around somewhere? If anyone knows the coordinates, it'd be fun to add them also.)

The reason the script should be put into the root prim of an object is that only root prims get the CHANGED_TELEPORT event.

The Code

You may do anything you like with this code, without limitation. Well, without limitation in the sense of me suing you, that is. If you do illegal things with it, you might get in trouble, for instance. And you can't do impossible things with it.

// Script by Dale Innis, January 2011.  You may do whatever you like with this script, without limitation.
 
// Updated June 2011 by Braclo Eber. 
// Some border sims of continents were missing from the detector.
// Changed some figures to be more accurate. (Nautilus Continent & Bay City Extension)
// Changed the order of the continents to reflect the changes.
// Included Nautilus City.
 
// Updated June 2013 by Braclo Eber.
// Updated coordinates for missing border regions on continents.
 
// Updated March 2014 by Braclo Eber.
// Small fix for Western Blake Sea,Blake Sea,Nautilus and Nautilus City. 
 
// Updated December 2015 by Braclo Eber.
// Added 11 private continents that currently qualify as continents as per http://slgi.wikia.com/wiki/List_Of_Continents
// NOTE: Due to how close some regions are to the private continents, some might indicate they are part of the continent due to how the script works.
// -----
 
// Each set of five list elements represents a grid-aligned rectangle, in the form xmin,xmax,ymin,ymax,name.
// The code returns the FIRST one that it finds, so its okay if the rectangles overlap, as long as you put
// the right one first.
 
list map = [
 257024.0,266240.0,229888.0,240640.0,"Jeogeot",
 251392.0,254464.0,256000.0,257280.0,"Bay City",
 254720.0,265984.0,250368.0,259072.0,"Sansara",
 253696.0,259840.0,259328.0,265472.0,"Heterocera",
 281344.0,290560.0,257280.0,268288.0,"Satori",
 290048.0,290816.0,268288.0,270080.0,"Western Blake Sea",
 290816.0,295424.0,266496.0,272128.0,"Blake Sea",
 286720.0,290048.0,268288.0,269056.0,"Nautilus City",
 283136.0,291072.0,268288.0,276992.0,"Nautilus",
 281600.0,296448.0,276992.0,281856.0,"Corsica",
 291840.0,295936.0,284672.0,289536.0,"Gaeta I",
 296960.0,304640.0,276736.0,281600.0,"Gaeta V",
 460032.0,466432.0,301824.0,307456.0,"Zindra",
// List of private continents.
 231424.0,232960.0,   261120.0,263168.0,"Caledon",
 231936.0,233216.0,   263168.0,264960.0,"Winterfell",
 171776.0,177408.0,   305664.0,311040.0,"Eden",
 250112.0,254720.0,   245248.0,248576.0,"Estate",
 233472.0,235264.0,   217344.0,219648.0,"FairChang",
 264704.0,267264.0,   351744.0,353536.0,"Mar Lesbiana",
 242944.0,244992.0,   293632.0,295680.0,"Wild West",
 208384.0,210176.0,   350976.0,352768.0,"Crossing Sands",
 192000.0,193792.0,   258560.0,261120.0,"Freedom",
 280320.0,281856.0,   249344.0,251136.0,"Shopping",
 219392.0,221952.0,   252416.0,254464.0,"Uhre",
// and then for places outside the bounds of mainland continents, some random names...
      0.0,250000.0,     0.0,999999.0,"the Western Ocean",  
 250000.0,265000.0,     0.0,999999.0,"the West",        
 265000.0,280000.0,     0.0,999999.0,"the Center Longitudes",         
 280000.0,310000.0,     0.0,999999.0,"the East",          
 310000.0,450000.0,     0.0,999999.0,"the Gap Longitudes",           
 450000.0,500000.0,     0.0,999999.0,"the Zindra Longitudes",            
 500000.0,999999.0,     0.0,999999.0,"the Far East"
];
 
string get_continent_name(vector gc) {
    integer count = llGetListLength(map);
    integer i;
    for (i=0;i<count;i+=5) {
        if ((gc.x>=llList2Float( map,i )) &&
            (gc.x<=llList2Float( map,i+1 )) &&        
            (gc.y>=llList2Float( map,i+2 )) &&                                
            (gc.y<=llList2Float( map,i+3 )) ) return llList2String( map,i+4 );
    }
    return "";
}
 
say_location() {
    vector gc = llGetRegionCorner()+llGetPos();
    llOwnerSay("Coordinates: "+(string)gc.x+","+(string)gc.y);
    string s = get_continent_name(gc);
    if (s!="") {
        llOwnerSay("You are in "+s);
    } else {
        llOwnerSay("You are not in any known area.");
    }  
}
 
default
{
 
    changed(integer change) {
        if (change & CHANGED_TELEPORT) say_location();
    }
 
    touch_start(integer total_number) {
         say_location();
    }
}


Another code

This script is a bit more complicated. Put it into a prim (an avatar attachment or HUD attachment should be the best). I only give you some coordinates, you can add all the others. Look on the map for most remote sims of a continent or other geographical feature, then go to Gridsurvey Gridsurvey to get the sim coordinates. You can add 40 geographical features without problems. If you want to add more, please make two scripts and put both into a prim. The script will pick-up the first continent it matches. So, if you want to detect Snowlands or Color Sims in Sansara, please put them before you put Sansara. If nothing is found, the script will answer nothing (you can add an 'else' event with an answer that no continent was detected.

Coordinates are available also frim this wiki. Search at page List Of Continents and the link to all continents and at page Oceans for all oceanic coordinates. For small map structures, coordinates can be found at List Of Microcontinents And Sim Clusters or at Second Life Geography.

//Created by Ana Imfinity
default
{
    state_entry()
    {
    }
    touch_start(integer Ana)
    {
        vector grc = llGetRegionCorner(); //This gives sim coordinates in meters
        float grcx = grc.x; //Longitude
        float grcy = grc.y; //Latitude
        integer xxx = (integer)(grcx/256); //Transforms longitude from meters to sim coordinates (like Gridsurvey)
        integer yyy = (integer)(grcy/256); //Transforms longitude from meters to sim coordinates (like Gridsurvey)
        string continent;
        string sim = llGetRegionName();
// Now, see that I repeat a formula, in which the xxx and yyy are 
//minimum and maximum latitude and longitude I found on Gridsurvey. 
//Add new locations after this model.
        if (xxx>1134 && xxx<1154 && yyy>1039 && yyy<1061)
        {
            continent = "Blake Sea Continent";
        }
        else if (xxx>903 && xxx<911 && yyy>1019 && yyy<1035)
        {
            continent = "Caledon-Winterfell Continent";
        }
        else if (xxx>1099 && xxx<1160 && yyy>1080 && yyy<1101)
        {
            continent = "Corsica Continent";
        }
        else if (xxx>675 && xxx<693 && yyy>1193 && yyy<1214)
        {
            continent = "Eden Continent";
        }
        else if (xxx>973 && xxx<1009 && yyy>944 && yyy<976)
        {
            continent = "Estate Continent";
        }
 
//Add here new continents (and oceans) following the model
 
        else
        {
            continent = "No continent detected";
        }
        string message = "Current grid position is: "+(string)(xxx)+"+"+(string)(yyy)+". Sim name is "+sim+" - "+continent;
        llOwnerSay(message);
    }
}

See Also

Functions

llGetRegionCorner - to find out the global coordinates of the southwest corner of this sim

llOwnerSay - to tell you about it

Constants

CHANGED_TELEPORT - to see if we've teleported

General

Linden Department of Public Works Roads - shows the major continents and their Linden roads

History of Second Life - includes some discussion of the geography

List Of Continents

Oceans

List Of Microcontinents And Sim Clusters

Lalo Telling's history page - has his very nice geohistory of the early grid