Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Changing textures on objects

Jinny Fonzarelli
"skin up 4 jesus"
Join date: 30 Mar 2004
Posts: 210
02-20-2005 08:04
I've been in SL for long enough that I really should have more of a handle on scripting, but I really can't get my head around it. So once again I am here, cap in hand, to ask for some assistance, please :-). I've searched the forums to no avail.

I'm building an actual house for the first time, with doors and windows. What I'd like to do is not have doors like RL doors but to have a phantom object with a semi-opaque texture, which can be changed to a solid object with a different texture when it's touched.

Could someone help with a script that would do this, please?
_____________________
"Sanity is not statistical." - 1984

my SL blog: http://jinny.squinny.net
Al Bravo
Retired
Join date: 29 Jun 2004
Posts: 373
02-20-2005 08:35
Working offline, so I can't see if this compiles.

CODE
integer open = FALSE;

integer FACE1 = 0; // adjust this to the front side of your door
integer FACE2 = 1; // adjust this to the back side of your door
string OPENTEXTURE = "OpenTexture.tga"; // rename this to your open texture
string CLOSEDTEXTURE = "ClosedTexture.tga"; // rename this to your closed texture

default
{
state_entry()
{
}

touch_start(integer num_detected)
{
open = !open;
if (open)
{
llSetTexture (OPENTEXTURE, FACE1);
llSetTexture (OPENTEXTURE, FACE2);
llSetStatus (STATUS_PHANTOM, TRUE);
}
else
{
llSetTexture (CLOSEDTEXTURE, FACE1);
llSetTexture (CLOSEDTEXTURE, FACE2);
llSetStatus (STATUS_PHANTOM, FALSE);
}
}
}
_____________________
Jinny Fonzarelli
"skin up 4 jesus"
Join date: 30 Mar 2004
Posts: 210
02-20-2005 08:39
Thank you! I'll give it a go! :)
_____________________
"Sanity is not statistical." - 1984

my SL blog: http://jinny.squinny.net
Jinny Fonzarelli
"skin up 4 jesus"
Join date: 30 Mar 2004
Posts: 210
02-20-2005 08:49
Once I worked out which face was which, it worked a treat-- thank you very much :-)
_____________________
"Sanity is not statistical." - 1984

my SL blog: http://jinny.squinny.net
Al Bravo
Retired
Join date: 29 Jun 2004
Posts: 373
02-20-2005 09:18
:)

You are welcome.
_____________________