integer OFF = TRUE;
// this variable is never read, remove it:
//integer toggleState = 0; // 0: Normal state, 1: Active state
integer faceToToggle = ALL_SIDES; // Replace with the face number you want to control
default
{
state_entry()
{
llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 5, 2, 0, 0,14.0);
llSetAlpha(1.0, ALL_SIDES);
}
on_rez(integer start_param)
{
llResetScript();
}
touch_start(integer num)
{
if(llDetectedKey(0) != llGetOwner()) return; // some would say this is bad form, but IMO it's more neat than enclosing the rest of the event in a section.
//OFF = !OFF; // because each condition set it to the opposite value, it makes more sense to reverse it before the if clause.
// ^ roughly the same as OFF = 1-OFF;
//if(OFF)
{
llSetAlpha(1.0-!(OFF=!OFF)*0.09, ALL_SIDES);
// Toggle between states on touch
// Turn off glow, set full bright to false, set transparency to 100
llSetPrimitiveParams(
[ PRIM_GLOW, faceToToggle,!OFF*0.3,
PRIM_FULLBRIGHT, faceToToggle,!OFF]);
llSetLinkAlpha(LINK_THIS,!OFF, faceToToggle);
}
/*else
{
llSetAlpha(0.01, ALL_SIDES);
// Turn on glow, set full bright to true, set transparency to 0
llSetPrimitiveParams(
[ PRIM_GLOW, faceToToggle, 0.3,
PRIM_FULLBRIGHT, faceToToggle, TRUE
]);
llSetLinkAlpha(LINK_THIS, 1.0, faceToToggle);
}*/
}
}