Drop up to 10 different textures into an object and this script. It will change to the next texture automatically.
It will change textures in the order that they appear in the object's contents, (alphabetical,) so rename them to choose the order.
Currently it will change the texture on all sides. For just one side change "ALL_SIDES" whenver it appears to the side number you want. llSetTexture(name, 1) for example.
integer number;
string name;
integer choice = 0;
default
{
state_entry()
{
llSetTimerEvent(2.5); //How many seconds inbetween textures
number = llGetInventoryNumber(INVENTORY_TEXTURE);
}
timer()
{
if (choice < number)
{
name = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (name != "")
llSetTexture(name, ALL_SIDES);
choice = choice + 1;
}
else
{
name = llGetInventoryName(INVENTORY_TEXTURE, choice);
if (name != "")
llSetTexture(name, ALL_SIDES);
choice = 0;
}
}
changed(integer change)
{
if (change & CHANGED_INVENTORY)
{
llResetScript();
}
}
}
|