animats Posted August 30, 2018 Share Posted August 30, 2018 It's possible to put the Second Life map on a prim and have it track where you are. Many aircraft have this. But how is that done? It's a browser on a prim, of course. But how do you scroll it from LSL to keep the map centered around the current position? Link to comment Share on other sites More sharing options...
KT Kingsley Posted August 30, 2018 Share Posted August 30, 2018 (edited) You can get the map texture UUIDs from Tyche Shepherd's grid survey, as well as other places, I think. You could make a square mesh plane with four square faces for the textures which you'd move around behind a border and swap the textures around to keep the desired location central. Edited August 30, 2018 by KT Kingsley 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 30, 2018 Share Posted August 30, 2018 I don't know how it's done, frankly, but if I had to do it myself, I would try making a mesh display screen that has four linked coplanar objects. Then I'd display the maps of four adjacent regions on those four objects and work through the math to vary the relative sizes of the objects so that my current position is always at the center of the display and the overall dimensions of the linkset stay constant. The real trick would be to vary the scaling factor of the texture on each object as I change the objects' dimensions, so that the composite map keeps a constant scale even as I change the scale of the linked objects. It would be a very clever display if I could pull it off. Link to comment Share on other sites More sharing options...
Callum Meriman Posted August 30, 2018 Share Posted August 30, 2018 Sample code on Tyche's site about 1/3 of the way down http://gridsurvey.com/api.php Link to comment Share on other sites More sharing options...
animats Posted August 30, 2018 Author Share Posted August 30, 2018 28 minutes ago, Callum Meriman said: Sample code on Tyche's site about 1/3 of the way down http://gridsurvey.com/api.php That just pulls the UUID of the texture onto a prim. It doesn't scroll it. There are "GPS" displays that display from maps.secondlife.com, and scroll them. I can do this without scrolling, but can't figure out how you send data to the browser on a prim short of loading an entirely new URL. Link to comment Share on other sites More sharing options...
Callum Meriman Posted August 30, 2018 Share Posted August 30, 2018 (edited) 20 minutes ago, animats said: That just pulls the UUID of the texture onto a prim. It doesn't scroll it. There are "GPS" displays that display from maps.secondlife.com, and scroll them. I can do this without scrolling, but can't figure out how you send data to the browser on a prim short of loading an entirely new URL. Ah sorry, misunderstood you, scatterbrained neko that I am. 8x8 mesh grid each displaying 64 meters... As a hud would be ok, not so great as a vehicle display. Not sure how it would look with scrolling. As above 4 linked mesh panels, that scale as you move. external server that grabs and merges with imgmagick and moap that I'd be hesitatant to use MOAP myself as a sizable number of people disable it for security. Edited August 30, 2018 by Callum Meriman removed the calc, it's wrong. Need to work offset to 128meters Link to comment Share on other sites More sharing options...
KT Kingsley Posted August 30, 2018 Share Posted August 30, 2018 I haven't looked into it in any great detail, but the LL reference at http://wiki.secondlife.com/wiki/Linden_Lab_Official:Map_API seems to offer at least the ability to generate a MOAP map that could be udated using successive calls with changing coordinates. Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted August 30, 2018 Share Posted August 30, 2018 This is why we need sprite and sprite sheet support for prim faces. 3 Link to comment Share on other sites More sharing options...
animats Posted August 30, 2018 Author Share Posted August 30, 2018 (edited) Maps on a prim. Right, the map from "maps.secondlife.com". Left, the Shergood Aviation map, which is the SL map with an overlay of aviation data. You can click and drag on either map, and you get smooth scrolling as the Javascript of the Leaflet map system loads the proper tiles. There's no obvious way to send your position, or any information, from LSL to the browser on the prim, to make the map update you move. But some people have been able to do it. Is there some LSL function I don't know about for this? Edited August 30, 2018 by animats Clarify Link to comment Share on other sites More sharing options...
ellestones Posted September 1, 2018 Share Posted September 1, 2018 (edited) On 8/31/2018 at 8:04 AM, animats said: There's no obvious way to send your position, or any information, from LSL to the browser on the prim, to make the map update you move i haven't done anything with MOAP for ages. But as I remember MOAP is a full-fledged web browser. Your web server to which the MOAP browser is connected, receives mouse/key inputs from the MOAP browser, the scrolling is done web server side. The main function of any LSL script in a MOAP browser is pretty for authentication purposes. Like who can/cannot operate the MOAP browser edit: in the case of a self-scrolling MOAP app centred on avatar position and rotation, then the MOAP prim LSL script just sends the avatars position/rotation to the web server Edited September 1, 2018 by ellestones Link to comment Share on other sites More sharing options...
animats Posted September 1, 2018 Author Share Posted September 1, 2018 6 hours ago, ellestones said: in the case of a self-scrolling MOAP app centred on avatar position and rotation, then the MOAP prim LSL script just sends the avatars position/rotation to the web server LSL gets to set the URL, but can't, as far as I can tell, interact with the loaded page. Link to comment Share on other sites More sharing options...
Rachel1206 Posted September 1, 2018 Share Posted September 1, 2018 (edited) 2 hours ago, animats said: LSL gets to set the URL, but can't, as far as I can tell, interact with the loaded page. Using embedded Java-scripts in the HTML string feed (<script> MyScript;</script>) should make it possible to interact with a given web page, given the web pages interactions are documented. The Linden Lab Map API is quite well documented. I would assume, this is how most advanced map based navigation work in world. Adding face layers, we can show position or display relevant information imposed independent of the underlying dynamic map layer. By no means a trivial task to code. Edited September 1, 2018 by Rachel1206 Link to comment Share on other sites More sharing options...
animats Posted September 1, 2018 Author Share Posted September 1, 2018 That doesn't let LSL send to the loaded page. You can load a new page from LSL, and even use a data URL to specify parameters, but that means loading a new URL for every move. That takes several seconds. Browser on a prim is slow. There's no way to do something like an XMLHTTPRequest from LSL. Or is there? Link to comment Share on other sites More sharing options...
ellestones Posted September 1, 2018 Share Posted September 1, 2018 @animats to do what you want with MOAP then yes the map manipulation needs to be done server side. Effectively replicating Google Maps using the SL world map tiles Link to comment Share on other sites More sharing options...
animats Posted September 2, 2018 Author Share Posted September 2, 2018 4 hours ago, ellestones said: @animats to do what you want with MOAP then yes the map manipulation needs to be done server side. Effectively replicating Google Maps using the SL world map tiles I can think of some ways to do this, but they're painful. Somehow you need a data channel between the browser on a prim and the prim itself. Something like this: The prim creates an inbound URL with llRequestURL so it can be called from the outside world. That URL returns the current world coords of the prim. The map is loaded using a data URL containing the code needed to display the map using Leaflet from an external map server. (SL, Grid Survey, Shergood Aviation, etc.) The data URL puts code in its web page to poll the inbound URL on the prim for current position. (Will this be rejected as cross-site scripting?) The replies to those polls are used to call the Leaflet Javascript calls to scroll the map. On each region crossing, we have to reload the map, because llRequestURL is a region local resource and we have no way to tell the browser on a prim about the change other than giving it a new URL to load. That's annoying, because the map will blank for a second or two. It's clunky but could work. No need for your own web server. Make about 1 poll every second if position is changing, slow down when position isn't changing, do a little local extrapolation to smooth the scrolling. There are more options if there's another web server somewhere to pass messages. Is that how the better GPS HUDs do it, or is there some less clunky approach? Link to comment Share on other sites More sharing options...
ellestones Posted September 2, 2018 Share Posted September 2, 2018 1 hour ago, animats said: I can think of some ways to do this, but they're painful. Somehow you need a data channel between the browser on a prim and the prim itself like you say can be quite a bit of work this. Is possible to have a prim object LSL-scripted to act as both a web browser and a web server. Probably Void Singer's Teacup is one of the better places to start down this road http://wiki.secondlife.com/wiki/User:Void_Singer/Teacup how well it might go toward meeting your objective I dunno. Using Teacup as a starting codebase would tho I think save a lot of dev time Link to comment Share on other sites More sharing options...
Xiija Posted September 2, 2018 Share Posted September 2, 2018 (edited) I dunno about MOAP, i did it with prim textures using Tyche's code as a base. anyhoo, rez a prim, shrink to HUD size, add this script and add /wear ? /* Example script to apply a Region Map as a texture on a Prim Author: Tyche Shepherd Date: 2010-02-11 Copyright: Tyche Shepherd 2008-2010 License: Creative Commons Attribution 2.0 UK:England & Wales License Basically you can do anything with this script including making derivative commercial works as long as you credit Tyche Shepherd and gridsurvey.com . This credit should be distributed with any product. See http://www.gridsurvey.com/api.php for more details on this license as well as any caveats. The script sets up a listen when the container prim is touched. The user then speaks the name of the desired region on the channel (default is channel 87) A llHTTPRequest is sent to http://api.gridsurvey.com which returns the UUID of that Region's Map if it's found. The Container Prim's texture is then changed to this UUID The Listen times out after 10 seconds. The gridsurvey.com Region Database is normally updated on a daily basis with the latest Region Maps. */ getmap() { query_string="region=" + llEscapeURL(region) + "&item=objects_uuid"; //send the request to api.gridsurvey.com requestID = llHTTPRequest("http://api.gridsurvey.com/simquery.php", [ HTTP_METHOD, "POST", HTTP_MIMETYPE,"application/x-www-form-urlencoded" ], query_string); } mapview() { myPos = llGetPos(); poz = < (myPos.x/256) - 0.5, (myPos.y/256) - 0.5 ,0.0>; // map repeats are from -0.5 to 0.5 set = poz ; llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, //set texture face, //on detected touch face map, //use this texture uuid <0.35,0.35,0.0>, //texture repeat set, // 0.0]); } key requestID; string query_string; string region; integer k; integer face = 4; string map; vector set ; vector myPos; vector poz; default { on_rez( integer param) { llResetScript(); } state_entry() { region = llGetRegionName(); getmap(); if(llGetAttached()) llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS); llSetTimerEvent(0.05); } http_response(key req_id, integer status, list meta, string body) { if (req_id == requestID) { if(llGetSubString(body, 0, 4)=="Error") { //the api returned an error so report it llSay(0, "errr \n" + body); } body = llStringTrim( body, STRING_TRIM); map = body; llSetLinkTexture(LINK_THIS,body, ALL_SIDES); } } // NO SCRIPT AREA HACK attach(key k) { if(k) llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS); } run_time_permissions(integer p) { if (p & PERMISSION_TAKE_CONTROLS) llTakeControls(CONTROL_FWD, TRUE, TRUE); } control(key k, integer l, integer e) {} // NO SCRIPT AREA HACK timer() { mapview(); } changed(integer change) { if (change & CHANGED_REGION) { llOwnerSay("Updating Region data..."); region = llGetRegionName(); getmap(); } } } Edited September 2, 2018 by Xiija 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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