string URL ="http://www.hyperica.com/lookup/?cat="; //Cat (category) numbers: //0: WELCOME //3: EDUCATION //8: RETAIL //10: VENUES string SimAddress; //the hypergrid address string SimName; //the destination region name string GridName; //name of the destination's grid key StatusQuery; //stores the key for the status request key httpkey;//This stores the key for the HTTP request we send. string body_retrieved; // this will hold what is returned from http request vector LandingPoint = <128.0, 128.0, 22.0>; vector LookAt = <1.0,1.0,1.0>; list LastFewAgents; LoadDestination () //checks the description for the destination { list Description = llParseString2List(llGetObjectDesc(),[","," "],[]); string Category = llList2String(Description,0); integer CatNum = 0; if (llToUpper(Category)=="EDUCATION") CatNum=3; if (llToUpper(Category)=="RETAIL") CatNum=8; if (llToUpper(Category)=="VENUES") CatNum=10; URL = URL+(string) CatNum+"®ion="+llList2String(Description,1)+"&sort=1"; httpkey=llHTTPRequest(URL, [] ,""); llSetText("No destination set.",<1,1,1>,1); } CheckDestination () //checks if the destination is up { StatusQuery = llRequestSimulatorData(SimAddress, DATA_SIM_STATUS); } PerformTeleport( key WhomToTeleport ) { integer CurrentTime = llGetUnixTime(); integer AgentIndex = llListFindList( LastFewAgents, [ WhomToTeleport ] ); // Is the agent we're teleporting already in the list? if (AgentIndex != -1) // If yes, check to make sure it's been > 5 seconds { integer PreviousTime = llList2Integer( LastFewAgents, AgentIndex+1 ); // Get the last time they were teleported if (PreviousTime >= (CurrentTime - 30)) return; // Less than five seconds ago? Exit without teleporting LastFewAgents = llDeleteSubList( LastFewAgents, AgentIndex, AgentIndex+1); // Delete the agent from the list } LastFewAgents += [ WhomToTeleport, CurrentTime ]; // Add the agent and current time to the list // llMapDestination(SimAddress, LandingPoint, LookAt); //teleports via the map osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt ); //teleports instantly, needs OS threat level set to high } default { state_entry() { LoadDestination(); //check the description for the destination } http_response(key id, integer status, list meta, string body) { body_retrieved = body; SimName = llGetSubString(body_retrieved, llSubStringIndex(body,"")+18, llSubStringIndex(body, "")-1); GridName = llGetSubString(body_retrieved, llSubStringIndex(body,"")+16, llSubStringIndex(body, "")-1); SimAddress = llGetSubString(body_retrieved, llSubStringIndex(body,"")+12, llSubStringIndex(body, "")-1); llSetText("Hypergate to "+ SimName +" on "+GridName,<1,1,1>,1); //the following section puts the destination text on the prim string CommandList = ""; CommandList = osMovePen( CommandList, 25, 75 ); CommandList += "FontSize 16;"; CommandList = osDrawText( CommandList, SimName +" on "+GridName ); osSetDynamicTextureDataBlendFace( "", "vector", CommandList, "width:256,height:256", FALSE, 2, 0, 255, 3 ); CheckDestination(); } dataserver(key queryId, string data) //turn gate black of destination is down { if (data=="up") llSetColor(<1.000, 1.000, 1.000>,1); else llSetColor(<0.067, 0.067, 0.067>,1); } touch_start(integer number) { LoadDestination(); } collision(integer number) { PerformTeleport( llDetectedKey( 0 )); } }