Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

touchstart texturechanger need help

raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
05-30-2008 20:41
im working on a house and i want to make a system to change the wall textures as i want, i have 3 textures really to use but i think if i can just get this thing to work with only 2 textures i can get the last texture in the script. anywho here it is,,,, i have made the scripts below and need them to allow only the owner to touch it, i have tried if (llDetectedKey(0) != llGetOwner()) but it wont work with the way i have the script so any help would be great.

CODE

//Touch Script goes in Master Prim
key owner;
integer on;
default
{
state_entry()
{
llPassTouches(TRUE);
}

touch_start(integer num_detected)
{
if(on)
{
on = FALSE;
llMessageLinked(LINK_SET, on, "","");

}
else
{
on = TRUE;
llMessageLinked(LINK_SET, on, "","");

}
}
}


And

CODE

//script in linked set to change texture when touch script tells it to
default
{
link_message(integer sender, integer num, string message, key id)
{
if(num)
{
llSetTexture("IMAGEKEY", ALL_SIDES);
}
else
{
llSetTexture("IMAGEKEY", ALL_SIDES);
}
}
}



thanks
Dylan Rickenbacker
Animator
Join date: 11 Oct 2006
Posts: 365
05-31-2008 07:10
Try this:

CODE

//Touch Script goes in Master Prim
key owner;
integer on;
default
{
state_entry()
{
llPassTouches(TRUE);
}

touch_start(integer num_detected)
{
if(llDetectedKey(0) == llGetOwner())
{
if(on)
{
on = FALSE;
llMessageLinked(LINK_SET, on, "","");
}
else
{
on = TRUE;
llMessageLinked(LINK_SET, on, "","");
}
}
}
}
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
05-31-2008 07:24
yep, only thing i would add is that you dont need the key owner; defined at top


EDIT

try this for second part also along with the other posted
CODE

//script in linked set to change texture when touch script tells it to
integer switch;
default
{
link_message(integer sender, integer num, string message, key id)
{
if((message == "on")&(switch))
{
llSetTexture("IMAGEKEY", ALL_SIDES);
!switch;
}
else if((message == "on")&(!switch))
{
llSetTexture("IMAGEKEY", ALL_SIDES);
switch;
}
}
}
raven Blair
Registered User
Join date: 2 Feb 2004
Posts: 39
thanks
05-31-2008 08:53
Thank you both, for the first script i cant believe it was that simple,,, and for the second script wow i never would have thought of that.... going to log in now and play with them :D



edit,,, i put the second script in with the first and it did not work.... changed the second script back to the way it was and it worked fine........