Difference between revisions of "User:Kerik Rau"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
=Code Snippets= | =Code Snippets= | ||
==Simple Stupid Slide Show== | ==Simple Stupid Slide Show== | ||
Line 76: | Line 47: | ||
==SLURL Raster Image URL Generator== | ==SLURL Raster Image URL Generator== | ||
I was rather interested in the raster images provided within SL and SLURL.com so I decided to figure out how to replicate it in such a way that it could be incorporated into tools and/or services outside the standard fair offered by Linden Labs | I was rather interested in the raster images provided within SL and SLURL.com so I decided to figure out how to replicate it in such a way that it could be incorporated into tools and/or services outside the standard fair offered by Linden Labs. | ||
<lsl> | <lsl> | ||
string MapTileURL() | |||
{ | |||
vector TilePos = llGetRegionCorner(); | |||
vector | |||
//tiles are in a grid based on the regions, so 256m = 1 tile | //tiles are in a grid based on the regions, so 256m = 1 tile | ||
TilePos /= 256.0; | |||
//offset provided in the javascript, really 1278 + 1 (probably 0 -> 1 index difference?) | //offset provided in the javascript, really 1278 + 1 (probably 0 -> 1 index difference?) | ||
TilePos.y = 1279.0 - TilePos.y; | |||
//should look like http://secondlife.com/apps/mapapi/grid/map_image/x-y-zoom-0 | //should look like http://secondlife.com/apps/mapapi/grid/map_image/x-y-zoom-0 | ||
Line 127: | Line 66: | ||
mapURL += "-"; | mapURL += "-"; | ||
mapURL += (string) llFloor(TilePos.y); | mapURL += (string) llFloor(TilePos.y); | ||
//the 3rd value is something to do with zoom | //the 3rd value is something to do with zoom | ||
mapURL += "-1-0"; | mapURL += "-1-0"; | ||
return mapURL; | return mapURL; | ||
} | } | ||
</lsl> | </lsl> |
Revision as of 15:28, 13 January 2009
Code Snippets
Simple Stupid Slide Show
Dumb slide show: simply rez a cube, throw in the script and textures and instant slide show. Ya, boring isn't it?
<lsl> integer Face = 2; float Delay = 25.0;
list Textures; integer TextureNum;
BuildDB() {
Textures = []; integer NumTextures = llGetInventoryNumber(INVENTORY_TEXTURE); while(NumTextures--) Textures += llGetInventoryName(INVENTORY_TEXTURE, NumTextures); llOwnerSay("Loaded Textures: " + llDumpList2String(Textures, ", "));
}
default {
state_entry() { BuildDB(); llSetTimerEvent(Delay); } changed(integer change) { if(change & CHANGED_INVENTORY) BuildDB(); } timer() { llSetTexture(llList2String(Textures, TextureNum), Face); if(++TextureNum >= llGetListLength(Textures)) TextureNum = 0; }
} </lsl>
SLURL Raster Image URL Generator
I was rather interested in the raster images provided within SL and SLURL.com so I decided to figure out how to replicate it in such a way that it could be incorporated into tools and/or services outside the standard fair offered by Linden Labs.
<lsl>
string MapTileURL()
{
vector TilePos = llGetRegionCorner(); //tiles are in a grid based on the regions, so 256m = 1 tile TilePos /= 256.0; //offset provided in the javascript, really 1278 + 1 (probably 0 -> 1 index difference?) TilePos.y = 1279.0 - TilePos.y; //should look like http://secondlife.com/apps/mapapi/grid/map_image/x-y-zoom-0 string mapURL = "http://secondlife.com/apps/mapapi/grid/map_image/"; mapURL += (string) llFloor(TilePos.x); mapURL += "-"; mapURL += (string) llFloor(TilePos.y); //the 3rd value is something to do with zoom mapURL += "-1-0"; return mapURL;
} </lsl>