Texture Cycle: Difference between revisions
Jump to navigation
Jump to search
New page: =====Cycle through textures on touch===== Cycles through textures in object inventory on touch <lsl> // Cycle thru textures in inventory on touch // @author: JB Kraft // ----------------... |
m <lsl> tag to <source> |
||
Line 3: | Line 3: | ||
Cycles through textures in object inventory on touch | Cycles through textures in object inventory on touch | ||
< | <source lang="lsl2"> | ||
// Cycle thru textures in inventory on touch | // Cycle thru textures in inventory on touch | ||
// @author: JB Kraft | // @author: JB Kraft | ||
Line 33: | Line 33: | ||
} | } | ||
} | } | ||
</ | </source> | ||
[[Category:LSL Examples]] | [[Category:LSL Examples]] |
Latest revision as of 18:08, 24 January 2015
Cycle through textures on touch
Cycles through textures in object inventory on touch
// Cycle thru textures in inventory on touch
// @author: JB Kraft
// ------------------------------------------------------------------------
// counter
integer g_NDX = 0;
// ------------------------------------------------------------------------
// D E F A U L T
// ------------------------------------------------------------------------
default
{
// --------------------------------------------------------------------
touch_start(integer total_number)
{
// get the number of texture in inventory
integer count = llGetInventoryNumber( INVENTORY_TEXTURE );
// if there are none, do nothing
if( count == 0 )
return;
// if we are past the last one, set th the first one
if( g_NDX > count - 1 )
g_NDX = 0;
// set the texture
llSetTexture( llGetInventoryName(INVENTORY_TEXTURE, g_NDX), ALL_SIDES);
// increase the count
++g_NDX;
}
}