Difference between revisions of "LibraryDisplayLandScreenshot"
(syntax error plus a little house keepng) |
m |
||
Line 2: | Line 2: | ||
--[[User:Jon Desmoulins|Jon Desmoulins]] 17:49, 16 February 2010 (UTC) | --[[User:Jon Desmoulins|Jon Desmoulins]] 17:49, 16 February 2010 (UTC) | ||
NOTE: Your location has to be in the search for this to work. Also, it may take some time for your location to appear in search if you just checked the "Show in Search" button in your land settings. (I forget the cache time) | NOTE: <s>Your location has to be in the search for this to work. (this limitation appears to have been removed.) Also, it may take some time for your location to appear in search if you just checked the "Show in Search" button in your land settings. (I forget the cache time)</s> (this limitation appears to have been removed, but there can still be delays for pages to update.) | ||
Edits: | Edits: | ||
Line 60: | Line 60: | ||
// If the parcel has no picture the image will be NULL_KEY or "". | // If the parcel has no picture the image will be NULL_KEY or "". | ||
if ((llGetSubString(parcelImage, 0, 0) == "\"") || (parcelImage == NULL_KEY)) { | if ((llGetSubString(parcelImage, 0, 0) == "\"") || (parcelImage == NULL_KEY)) | ||
{ | |||
llOwnerSay("No image for this parcel"); // Tell the avatar they have no picture | llOwnerSay("No image for this parcel"); // Tell the avatar they have no picture | ||
ResetTextures(); | ResetTextures(); |
Revision as of 00:00, 4 October 2010
This is nothing special, but it gets the job done. :) --Jon Desmoulins 17:49, 16 February 2010 (UTC)
NOTE: Your location has to be in the search for this to work. (this limitation appears to have been removed.) Also, it may take some time for your location to appear in search if you just checked the "Show in Search" button in your land settings. (I forget the cache time) (this limitation appears to have been removed, but there can still be delays for pages to update.)
Edits:
- 2/19/2010 - Erased my own land's key from the code, forgot to omit this on submission.
- 10/4/2010 (Cerise) - whacked a typo and shuffled some deck chairs
<lsl>// Credit goes to Jana Kamachi/Solar Alter // for discovering this concept first // and taking it beyond just displaying the profile picture // see http://forums.secondlife.com/showthread.php?t=225460 // and https://wiki.secondlife.com/wiki/User:Jana_Kamachi/Profile // for further information
/*
Modified by Jon Desmoulins to use the new PARCEL_DETAILS_ID to fetch the image that displays on the world.secondlife.com pages It's a little hacky, but it works.
- /
string gLandUrl = "http://world.secondlife.com/place/"; //Base URL for world search string gMetaTag = "<meta name=\"imageid\" content=\""; // tag that will contain the texture UUID integer gMetaTagLength;
ResetTextures() {
llSetTexture(TEXTURE_BLANK, ALL_SIDES);
}
default {
state_entry() { ResetTextures(); gMetaTagLength = llStringLength(gMetaTag); } touch_start(integer num_detected) { string requestUrl = gLandUrl + (string)llList2Key(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_ID]), 0); llOwnerSay(requestUrl); llHTTPRequest(requestUrl, [], ""); }
on_rez(integer start_param) { ResetTextures(); } http_response(key request_id,integer status, list metadata, string body) { if (status == 200) { // Find starting point of the land picture UUID integer uuidStart = llSubStringIndex(body, gMetaTag) + gMetaTagLength; // Parse out land UUID from the body string parcelImage = llGetSubString(body, uuidStart, uuidStart + 35); // If the parcel has no picture the image will be NULL_KEY or "". if ((llGetSubString(parcelImage, 0, 0) == "\"") || (parcelImage == NULL_KEY)) { llOwnerSay("No image for this parcel"); // Tell the avatar they have no picture ResetTextures(); } else { llOwnerSay("Found parcel image " + parcelImage); llSetTexture(parcelImage, ALL_SIDES); } } else { llOwnerSay("Could not retrieve parcel page"); ResetTextures(); } }
}</lsl>