

now_hidden = 0;

n1 = 0;
n2 = 0;
n3 = 0;
n4 = 0;

x1 = 1;
x2 = 2;
x3 = 3;
x4 = 4;

n1_true = false;
n2_true = false;
n3_true = false;
n4_true = false;

x = 0;
y = 0;

flag = true;
OpenPlushes();

function mini_create ()
	init_mini(true);
	create_mini(8128);
end;

function gameinput (sender,id,attachedID)
MiniInterfaceHandler( sender, id );	
	if sender==26 then
		RemoveWindow(8,2.8,"DestroyMyWindow")	
	end
	if sender == 33 then
	
	
		CreateWindow(CWX,CWY,"666",2222,nil,100,230);
		
	
	
		if plushes_were_closed then
			clear_satelite_leaf("dark_cave");
		end;
		
 end;

	
	if sender==30 then
	if mini_start then
			StopAllEffects()
			setstatemenu()
			StopMusic()
			mini_start=false;
		return;end
		delete_tree_leaf("Root",nazvlevela);	
		NextLevel(30)	
	return;end
	
	
	if sender==10 then	
			mini_start=false;
		flags.mini1 = true;		
		-- LevelEnd(28)
		
		flags.mini27=true;
		del_object_from_game(obj.dragonfly.id)
		 leafobj={2234}
			GetRenderTarget(2234,"rendertar");	
			minigg=true;
			levelnext=28;
	return; end;
	
	
	if sender == 1 then
		MiniInterfaceHandler( sender, id );
					
		if (id > 9) and (id < 19) then
			playeffect("132")
			speciale_action(2, id);
			now_hidden = id;
			if (id == 11) and not n1_true then
				speciale_action(2,30+n1);
				n1 = math.abs((n1 - 1) % 10);
				speciale_action(2,30+n1);
			elseif (id == 12) and not n2_true then
				speciale_action(2,40+n2);
				n2 = math.abs((n2 - 1) % 10);
				speciale_action(2,40+n2);
			elseif (id == 13) and not n3_true then
				speciale_action(2,50+n3);
				n3 = math.abs((n3 - 1) % 10);
				speciale_action(2,50+n3);
			elseif (id == 14) and not n4_true then
				speciale_action(2,60+n4);
				n4 = math.abs((n4 - 1) % 10);
				speciale_action(2,60+n4);
			elseif (id == 15) and not n1_true then
				speciale_action(2,30+n1);
				n1 = math.abs((n1 + 1) % 10);
				speciale_action(2,30+n1);
			elseif (id == 16) and not n2_true then
				speciale_action(2,40+n2);
				n2 = math.abs((n2 + 1) % 10);
				speciale_action(2,40+n2);
			elseif (id == 17) and not n3_true then
				speciale_action(2,50+n3);
				n3 = math.abs((n3 + 1) % 10);
				speciale_action(2,50+n3);
			elseif (id == 18) and not n4_true then
				speciale_action(2,60+n4);
				n4 = math.abs((n4 + 1) % 10);
				speciale_action(2,60+n4);
			elseif id == 10 then
				check_numbers();
			return;end;
		end;
	return; end;
	
	if sender == 6 then
	
		if now_hidden ~= 0 then
			speciale_action(2, now_hidden);
			now_hidden = 0;
		return; end;
	end;
end;

function check_numbers()
	if (n1 == x1) and not n1_true then
		n1_true = true;
		x,y = GetObjectPosition(30+n1);
		speciale_action(2,30+n1);
		addactivobjecttogame(1,""..n1, x,y,"","");
		speciale_action(4,1);
	end;
	if (n2 == x2) and not n2_true then
		n2_true = true;
		x,y = GetObjectPosition(40+n2);
		speciale_action(2,40+n2);
		addactivobjecttogame(2,""..n2, x,y,"","");
		speciale_action(4,2);
	end;
	if (n3 == x3) and not n3_true then
		n3_true = true;
		x,y = GetObjectPosition(50+n3);
		speciale_action(2,50+n3);
		addactivobjecttogame(3,""..n3, x,y,"","");
		speciale_action(4,3);
	end;
	if (n4 == x4) and not n4_true then
		n4_true = true;
		x,y = GetObjectPosition(60+n4);
		speciale_action(2,60+n4);
		addactivobjecttogame(4,""..n4, x,y,"","");
		speciale_action(4,4);
	end;
	if n1_true and n2_true and n3_true and n4_true then
		AlternateTimer("endgame", 500);
	end;
return;end;

function endgame()
	finish_mini_game(true);
return;end;