Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Touch texture change using states - window example

ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
09-16-2006 09:04
Here is a script using touch to rotate between two different textures. I tested these scripts in SL before posting them here.

If you use the texture name, such as "window" in the llSetTexture call, then you must also include the texture in the object contents with the script. You can use the UUID of the texture instead, which is what I prefer to do, as it simplifies the permissions issues.

These will respond to anyone's touch, not just those you give permissions to. That is another level of complications I have not addressed.

CODE
//This script rotates between textures window and blind textures when touched.

default
{
touch_start(integer total_number)
{
llSetTexture("window",ALL_SIDES);//the texture shown in the default state is "window".
llSetAlpha(1.0,ALL_SIDES);//1.0 shows all of a texture, 0.0 shows none
llScaleTexture(1,1, ALL_SIDES);//adjusts texture scale if needed.
state blinds;

}
}
state blinds
{
touch_start(integer total_number)
{
llSetTexture("blinds",ALL_SIDES);
llSetAlpha(1.0,ALL_SIDES);
llScaleTexture(1,1, ALL_SIDES);
state default;
}
}


Here is another example rotating between 3 textures:

CODE
//This script rotates between textures 3 textures when touched.

default
{
touch_start(integer total_number)
{
llSetTexture("window",ALL_SIDES);//the texture shown in the default state is "window".
llSetAlpha(1.0,ALL_SIDES);//1.0 shows all of a texture, 0.0 shows none
llScaleTexture(1,1, ALL_SIDES);//adjusts texture scale if needed.
state blinds;

}
}
state blinds
{
touch_start(integer total_number)
{
llSetTexture("blinds",ALL_SIDES);
llSetAlpha(1.0,ALL_SIDES);
llScaleTexture(1,1, ALL_SIDES);
state stone;
}
}
state stone
{
touch_start(integer total_number)
{
llSetTexture("stone",ALL_SIDES);
llSetAlpha(1.0,ALL_SIDES);
llScaleTexture(1,1, ALL_SIDES);
state default;
}
}
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
09-16-2006 13:48
/54/b7/137945/1.html
_____________________
i've got nothing. ;)
El3GANT Cabaret
Registered User
Join date: 21 Nov 2006
Posts: 4
Question: Not all sides...
12-14-2006 05:55
What if i only want inward/outward sides and not the outside edges?

Thanks