Jump to content

GPS script


anonymousmouse2
 Share

You are about to reply to a thread that has been inactive for 1610 days.

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

Recommended Posts

Hello! there is a script showing a map of the region. how to make it to run only when the engine is started? and when it is turned off then a different texture of the off screen was shown?

Basically it had some unused features I removed and added map refresh on changed region. Also I have such a link_message portion, I guess its out there?

    link_message(integer link, integer num, string msg, key id)
    {
        if(num == -707071 && id == "engine")
        {
            if( msg == "STOP ENGINE") llSetTimerEvent(timerFreq);
            else if( msg == "START ENGINE") llResetScript();
            RefreshMap();
        
        }
    }

// Simple Second Life region map grab/update script. Uses the gridsurvey.com API 
//////////////////////////////////////////////////////////////////////
// Holds the key of the last request.
key g_keyRequest;

//////////////////////////////////////////////////////////////////////
// Force a refresh of the region map.
RefreshMap()
{
    g_keyRequest = llHTTPRequest( "http://api.gridsurvey.com/simquery.php?" +
            "region=" + llEscapeURL( llGetRegionName() ) + "&item=objects_uuid",
            [ HTTP_METHOD, "GET" ], "" );
}

//////////////////////////////////////////////////////////////////////
// Default state.
default
{
    //////////////////////////////////////////////////////////////////
    // Start entry.
    state_entry()
    {
        // Do an initial refresh.
        RefreshMap();
        
    }

    changed(integer change)
    {
        if(change & CHANGED_LINK & CHANGED_REGION || change & CHANGED_INVENTORY)
        {
            llResetScript();
            RefreshMap();
        }
    }
    
    
    //////////////////////////////////////////////////////////////////
    // Handle the HTTP response from the request for the map UUID.
    http_response( key request_id, integer status, list metadata, string body )
    {
        // If the response is in response to our request...
        if ( request_id = g_keyRequest )
        {
            // ...if it's not an error...
            if ( llGetSubString( body, 0, 4 ) != "Error" )
            {
                // Set the texture of the first face to the map.
                llSetLinkPrimitiveParamsFast( 42, [PRIM_TEXTURE, 2, body, <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0 ]);
            }
        }
    }
}

 

Link to comment
Share on other sites

I almost managed to get it to work, but the script has an update timer of 0.1 seconds, and now it says something about the VERBOSE MODE and starts to get very laggy. I wonder what it is? Is it ok to have timer 1.0 in this case (http etc.)? Not too fast?

Edited by anonymousmouse2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1610 days.

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...