Difference between revisions of "User:Kerik Rau"

From Second Life Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Code Snippets=
For all intentions this is a dumping ground of information that might be useful.  All the information found here is free to use however you wish with no limitations.


==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>
{| width="90%"  style="background: #B8E2FF; border: 1px solid #0090FF;"
integer Face = 2;
|- align="center"
float Delay = 25.0;
| width="150px" | Projects
| Description
|-
| [[ User:Kerik_Rau/Apoc | Apocalypse HUD ]]
| A modular tool designed to reduce code reproduction and provide the shortest path available for a given task.  Thus it is fast and highly scalable by design.
|-
| [[ User:Kerik_Rau/n2k.AppSpot | n2k.AppSpot ]]
| A project aiming to make a name2key and key2name service via Google's App Engine that utilizes the Second Life Search rather than storing keys within a database.
|}


list Textures;
integer TextureNum;


BuildDB()
{
    Textures = [];
    integer NumTextures = llGetInventoryNumber(INVENTORY_TEXTURE);
   
    while(NumTextures--)
        Textures += llGetInventoryName(INVENTORY_TEXTURE, NumTextures);
       
    llOwnerSay("Loaded Textures: " + llDumpList2String(Textures, ", "));
}


default
{| width="90%" style="background: #FFEC80; border: 1px solid #E3AD35;"
{
|- align="center"
    state_entry()
| width="150px" | Scripts
    {
| Description
        BuildDB();
|-
        llSetTimerEvent(Delay);
| [[ User:Kerik_Rau/Simple Slide Show | Simple Slide Show ]]
    }
| Throw in the textures and it will automatically rotate through them.
   
|-
    changed(integer change)
| [[ User:Kerik_Rau/MapTileURL | Map Tile URL ]]
    {
| An LSL function that returns a string containing the current regions tile URL
        if(change & CHANGED_INVENTORY)
|-  
            BuildDB(); 
| [[ User:Kerik_Rau/XY2URL | XY to URL ]]
    }
| A simple script that adds multiple links to a single prim
   
|}
    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>

Latest revision as of 22:01, 26 January 2009

For all intentions this is a dumping ground of information that might be useful. All the information found here is free to use however you wish with no limitations.


Projects Description
Apocalypse HUD A modular tool designed to reduce code reproduction and provide the shortest path available for a given task. Thus it is fast and highly scalable by design.
n2k.AppSpot A project aiming to make a name2key and key2name service via Google's App Engine that utilizes the Second Life Search rather than storing keys within a database.


Scripts Description
Simple Slide Show Throw in the textures and it will automatically rotate through them.
Map Tile URL An LSL function that returns a string containing the current regions tile URL
XY to URL A simple script that adds multiple links to a single prim