| On and off light. 
 
				Hello! I come here for a code.sorry if this is not well understood English ... that I speak Spanish and am using the translator
 I hope you understand me
 
 I want prener a light with a button or area (same for me) and off (like a switch). This time it was with a book by touching an area comprising a light.
 
 But I have a problem. Achievement on and off the light but after aver done this. no light turns back on, it's like only use the script only once I leave here.
 
 
 void OnStart()
 {
 SetLocalVarInt("Var0", 0);
 SetLocalVarInt("Var1", 0);
 AddEntityCollideCallback("B0", "A0A", "Prender0", true, 1);
 AddEntityCollideCallback("B1", "A1A", "Prender1", true, 1);
 AddEntityCollideCallback("B0", "D0", "Desactivo0", true, 1);
 AddEntityCollideCallback("B1", "D1", "Desactivo1", true, 1);
 
 }
 
 void Desactivo0(string &in asParent, string &in asChild, int alState)
 {
 SetLocalVarInt("Var0", 0);
 
 
 }
 void Desactivo1(string &in asParent, string &in asChild, int alState)
 {
 SetLocalVarInt("Var1", 0);
 
 
 
 }
 
 void Prender1(string &in asParent, string &in asChild, int alState)
 {
 AddLocalVarInt("Var1", 1);
 if(GetLocalVarInt("Var1") == 1)
 {
 
 SetLampLit("l1", false, false);
 SetLampLit("l2", false, false);
 SetLampLit("l3", false, false);
 SetLampLit("l4", false, false);
 SetLampLit("l5", false, false);
 SetLampLit("l6", false, false);
 SetLampLit("l7", false, false);
 SetLampLit("l8", false, false);
 SetLampLit("l9", false, false);
 SetLampLit("l10", false, false);
 SetLampLit("l11", false, false);
 SetLampLit("l12", false, false);
 SetLampLit("l13", false, false);
 SetLampLit("l14", false, false);
 SetLampLit("l15", false, false);
 SetLampLit("l16", false, false);
 SetLampLit("l17", false, false);
 SetLampLit("l18", false, false);
 SetLampLit("l19", false, false);
 SetLampLit("l20", false, false);
 
 SetLampLit("l16", true, true);
 SetLampLit("l12", true, true);
 SetLampLit("l8", true, true);
 SetLampLit("l4", true, true);
 SetLampLit("l20", true, true);
 }
 
 }
 void Prender0(string &in asParent, string &in asChild, int alState)
 {
 AddLocalVarInt("Var0", 1);
 if(GetLocalVarInt("Var0") == 1)
 {
 SetLampLit("l1", false, false);
 SetLampLit("l2", false, false);
 SetLampLit("l3", false, false);
 SetLampLit("l4", false, false);
 SetLampLit("l5", false, false);
 SetLampLit("l6", false, false);
 SetLampLit("l7", false, false);
 SetLampLit("l8", false, false);
 SetLampLit("l9", false, false);
 SetLampLit("l10", false, false);
 SetLampLit("l11", false, false);
 SetLampLit("l12", false, false);
 SetLampLit("l13", false, false);
 SetLampLit("l14", false, false);
 SetLampLit("l15", false, false);
 SetLampLit("l16", false, false);
 SetLampLit("l17", false, false);
 SetLampLit("l18", false, false);
 SetLampLit("l19", false, false);
 SetLampLit("l20", false, false);
 
 SetLampLit("l1", true, true);
 SetLampLit("l2", true, true);
 SetLampLit("l3", true, true);
 SetLampLit("l4", true, true);
 SetLampLit("l5", true, true);
 SetLampLit("l9", true, true);
 SetLampLit("l13", true, true);
 SetLampLit("l17", true, true);
 SetLampLit("l20", true, true);
 SetLampLit("l16", true, true);
 SetLampLit("l12", true, true);
 SetLampLit("l8", true, true);
 SetLampLit("l18", true, true);
 SetLampLit("l19", true, true);
 
 }
 
 }
 hopefully can give me the solution Thanks.
 
				
(This post was last modified: 07-16-2012, 11:33 PM by gabiaef.)
 |