string URL ="https://docs.google.com/spreadsheet/pub?key=0Atezdu2xUAJJdElfQmJSWW9HQUxDblpvLS1maVZSLUE&single=true&gid=0&output=csv"; string SimAddress="ccdbbs.com:8002"; //the hypergrid address string Website="http://ccdbbs.com:8002/wifi/"; //the website address string SnapshotURL="http://www.hyperica.com/wp-content/uploads/2012/02/Lost_Paradise-ad.png"; //URL of the ad string GridName="Lost Paradise"; //name of the destination's grid string SimLocation="Upper"; //Upper, middle or lower vector LandingPoint = <128.0, 128.0, 22.0>; vector LookAt = <1.0,1.0,1.0>; list LastFewAgents; list DataList; key httpkey; integer CellCount; integer RowCount; integer ColumnCount = 8; integer CurrentRow = 1; //Sets a grid of x by y, and returns that number on touch. float x=2.0; float y=1.0; integer Pos; 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 osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt ); } ShowAd ( integer row) { SimAddress = llList2String(DataList,row*ColumnCount+5); Website = llList2String(DataList,row*ColumnCount+4); SnapshotURL = llList2String(DataList,row*ColumnCount+3); GridName = llList2String(DataList,row*ColumnCount+8); SimLocation = llList2String(DataList,row*ColumnCount+6); string URLTexture = osSetDynamicTextureURL("", "image", SnapshotURL, "", 600); llSetTexture(URLTexture,ALL_SIDES); llSetTexture("Grid-Website buttons",2); llSetTexture("Click here for your free ad",4); } default{ state_entry() { httpkey=llHTTPRequest(URL, [] ,""); } touch_start(integer total_number) { integer i; integer touchedFace = llDetectedTouchFace(i); key gAvatarKey = llDetectedKey(0); vector pos = llDetectedTouchST(0); Pos = ((llFloor(((1-pos.y)*10)*y)/10)*(integer)x)+llCeil(pos.x*x); if (touchedFace == 2) { if (Pos==1) PerformTeleport( llDetectedKey( 0 )); if (Pos==2) llLoadURL(gAvatarKey, "Go to website.", Website); } if (touchedFace == 4) { llLoadURL(gAvatarKey, "Go to website.", "http://www.hyperica.com/free-hyperica-billboard-submission-form/"); } if ((touchedFace == 0) && (llDetectedKey(0) == llGetOwner())) { CurrentRow = 1+ (integer)llFrand(RowCount); ShowAd(CurrentRow); } } http_response(key id, integer status, list meta, string body) { DataList = llParseString2List(body, [",","\n"], [] ); CellCount = llGetListLength(DataList); RowCount = ((CellCount-1)/ColumnCount) -1 ; CurrentRow = 1+ (integer)llFrand(RowCount); ShowAd(CurrentRow); } }