Here's a script to turn the flames on and off when you touch the fire. (ouch?)
To use it, name all the prims that are textured with the flame texture with the same name, and do NOT use that prim name for the rest of the prims.
Put the script in one of the flame prims. In that same prim, adjust the "features -> light" (in edit popup) to give the glow you want all the flame prims to have when the fire is on.
When the script is initialized, it assumes the fire is on. After that, when you touch it, if it's on it will do two things to each prim named "flames" (using the naming convention embedded below -- you can change that):
1) Changes the texture to 100% transparent, making the flames invisible.
2) Turns the "light" feature off, killing the glow.
Click again to turn on, which does this to each prim named "flames":
1) Changes the texture to 0% transparent. Note that the transparency mask (alpha channel) in the texture will still be honored.
2) Turns the "light" feature on, and sets the color to match whatever the containing prim was when the script reset.
It would be nice if it could leave the color alone in each prim, but there is no "llGetLinkPrimitiveParameters()", and you can't throw the "light" switch without setting the color using "llSetLinkPrimitiveParams()".
This script assumes there are at least 2 prims. It's inappropriate for use in a single-prim object.
// Set this variable to the name of the prims that are textured with the flame texture.
string FLAME_PRIM_NAME = "flames";
float Alpha = 1.0;
integer Glow = 1;
list light;
default
{
state_entry()
{
light = llGetPrimitiveParams([PRIM_POINT_LIGHT]);
}
touch_start(integer total_number)
{
if (Glow == 0) {
Alpha = 1.0;
Glow = 1;
llWhisper(0, "Fire on");
} else {
Alpha = 0.0;
Glow = 0;
llWhisper(0, "Fire off");
}
light = llListReplaceList(light, [Glow], 0, 0);
integer link;
for (link = 1; link <= llGetNumberOfPrims(); link++) {
if (llGetLinkName(link) == FLAME_PRIM_NAME) {
llSetLinkAlpha(link, Alpha, ALL_SIDES);
llSetLinkPrimitiveParams(link, [PRIM_POINT_LIGHT] + light);
}
}
}
}
There's also a trick if you want the script in a non-flame prim for some reason. Set that prim's light to what you want the flames to have, start the script, and then change the light for the prim contaning the script back to what it should be. This works fine until you have to reset the script for some reason.