It means, if we click on the left one it will turn the page back and if the right one is clicked it'll turn to the next 2 pictures.
It works fine, except when it arrives to the last picture or first one.. I want it to be able to ignore clicks on the proper button if we've reached the max/min index.
How can I do it?
Here's the code snippet...
CODE
link_message(integer sender_num, integer num, string msg, key id)
{
if (numberTextures)
{
if (("NEXT" == msg) || ("PREV" == msg))
{
if ("NEXT" == msg )
{
//*************** PROBLEM STARTS HERE ***************
if ( currentTexture < numberTextures-1 )
{
currentTexture+=2;
}
}
else
{ //substract one
if ( currentTexture < numberTextures-1 && currentTexture!=0 )
{
currentTexture-=2;
}
else
{
currentTexture=0;
}
}
currentTexture = (currentTexture + numberTextures) % numberTextures;
llSetTexture( llGetInventoryName( INVENTORY_TEXTURE, currentTexture ), 0);
llMessageLinked(LINK_SET,1,(string)llGetInventoryKey(llGetInventoryName(INVENTORY_TEXTURE, currentTexture-3)),NULL_KEY);
//******************************
}
}
}//link_message
Thank you =)