I got this working perfectly, then tried to change it, broke it, and forgot how it worked. Now I'm starting over.
Basically, I'm trying to get the script to make certain prims visible in a certain sequence when responding to a HUD, and either turn off or on depending on if the prim is already on (cupon), or another linked prim is already on (on). The HUD works fine. The problem is for some reason, despite the script's toggles being set "OFF," the script behaves as if they're "TRUE" when being triggered by the HUD, and it doesn't toggle, it just repeats the same function (power_off()) over and over. power_on(), power_off(), and cup_on just make different prims visible in different colors. I figure I'm missing something obvious but am at my wit's end. Any help would be appreciated.
all_off()
{
llSetLinkPrimitiveParamsFast( LINK_ALL_CHILDREN, [ PRIM_GLOW, ALL_SIDES, 0.0, PRIM_COLOR, ALL_SIDES, white, 0.0 ] );
llSetLinkPrimitiveParamsFast( 3, [ PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 1.0, 1.0]);
on = FALSE;
cupon = FALSE;
}
default
{
state_entry()
{
llSetLinkPrimitiveParamsFast( LINK_ALL_CHILDREN, [ PRIM_GLOW, ALL_SIDES, 0.0, PRIM_COLOR, ALL_SIDES, white, 0.0 ] );
llSetLinkPrimitiveParamsFast( 3, [ PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 1.0, 1.0]);
on = FALSE;
cupon = FALSE;
HUD_channel=-11*llAbs((integer)("0x"+ llGetSubString(llGetOwner(),0,7)));
key owner = llGetOwner();
llListen(HUD_channel,"","","");
}
listen( integer channel, string name, key id, string message )
{
if( message == "SHUD92" )
{
if(on = TRUE)
{
if(cupon = TRUE)
{
power_off();
all_off();
}
else
{
power_on();
on = TRUE;
cupon = TRUE;
}
}
else if (on = FALSE)
{
cup_on();
on = TRUE;
cupon = TRUE;
}
}
}
}