Get Region Map

Written by Kitsune

Displays map image of current sim on prim & updates every 24 hours.

 

integer time = 86400; //update every 24 hours

key httpRequestId;
string mapTexture;
string URL = "http://www.subnova.com/secondlife/api/map.php";
 
default 
{
    on_rez( integer sparam )
    {
        llResetScript();
    }
    
    state_entry() 
    {
        llSetTimerEvent(time);
        httpRequestId = llHTTPRequest(URL + "?" + "sim" + "=" + llEscapeURL(llGetRegionName()),[], "");
    }
    
    http_response(key request_id, integer status, list metadata, string body)
    {
        if (request_id == httpRequestId) 
        {
            mapTexture = body;
            llSetTexture(mapTexture, ALL_SIDES); //you can replace ALL_SIDES with a side number instead
        }
    }
    
    timer() 
    {
        httpRequestId = llHTTPRequest(URL + "?" + "sim" + "=" + llEscapeURL(llGetRegionName()),[], "");
    }
}