It depends how and when you want to do it. The only script that runs in a loop normally is game_daemon.script.
All other scripts only run once when you tell them to. So, setting the variable to 1 won't change the entity because there is nothing that is checking the variable. Hope that makes sense.
Sounds like you're checking the variable in scene_init.script, which only runs when you first enter the scene.
So, for example, if you wanted to left click on something, and then make the entity visible only if the variable is 1, you'd do this:
on "LeftClick"
{
var ent = Scene.GetNode("xxx");
if(yyy==1) ent.Active = true;
}
Then it will become visible when you left click. You can set the variable in any other script that you like.