Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Toggling textures using Touch

Rock Vacirca
riches to rags
Join date: 18 Oct 2006
Posts: 1,093
08-13-2008 13:01
Hi,

I would like to use the touch event to select texture1, then touch the prim again and texture2 is selected, and so on, toggling the 2 textures.

I can figure the touch script to select one texture, but I cannot think how to achieve a toggling effect.

A pointer or two would be most appreciated.

TIA

Rock
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
08-13-2008 13:07
Haven't tested it but something like this might work...

CODE

integer gTexture1 = FALSE;

key Texture1 = "....";
key Texture2 = "....";

Toggle()
{
gTexture1 = !gTexture1;

key texture;
if (gTexture1)
texture = Texture1;
else
texture = Texture2;

llSetTexture (texture, ALL_SIDES);
}

default
{
touch_start(integer total_number)
{
Toggle();
}
}
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left