To simplify it, skip the LocalVars all together and use a better naming on your areas and light that way you can make this really simple.
void BOX1LIGHT(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
SetLightVisible(asChild+"_light", true);
}
else if(alState == -1)
{
SetLightVisible(asChild+"_light", false);
}
}
So you check the variable that tells you if something enters or leaves the area, that is alState.
Then if you name you lights the same as the area but suffix them with _light, you can use the variable with the name of the area to not write everything specific.
Example: Area is named "MyArea", you name the light "MyArea_Light", in the script you then use asChild+"_Light" which is the same as "MyArea_Light" because asChild is the variable containing what area it is that something entered into.