osgrid.org
https://forums.osgrid.org/

Map on a prim
https://forums.osgrid.org/viewtopic.php?f=5&t=6085
Page 1 of 1

Author:  Scooby Scorfield [ Thu Jan 25, 2018 8:17 am ]
Post subject:  Map on a prim

Hi All,
I'm trying to learn some scripting and something I'd find useful for my regions is a map on a prim - Just the image from the main OSGrid map for a given region as a texture on a prim. I know I can screen-grab and save the texture, but I'd like to make it more dynamic so it updates once a day or whatever.
Where is the best place to start with this? I have searched the forum for similar scripts but can't find anything.

Thanks,
Scoobs X

Author:  Scooby Scorfield [ Fri Jan 26, 2018 3:55 am ]
Post subject:  Re: Map on a prim

I found this example online so I have been playing about with it, firstly swapping the URL for the OSGrid one:-


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()),[], "");
   }
}



But the process seems to grind to a halt at "if (request_id == httpRequestId) "

Scoobs X

Author:  dj phil [ Fri Jan 26, 2018 4:39 am ]
Post subject:  Re: Map on a prim

Try this or this :)

Author:  Scooby Scorfield [ Fri Jan 26, 2018 2:23 pm ]
Post subject:  Re: Map on a prim

Omg I can't believe I didn't find those googling... I can't believe my noobpidity!

Thank you very much Phil!

Ta,
Scoobs X

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/