
-- CreateConsole()
local frame= 0
function gameinput (sender,obj_id,attachedID)
-----------------------------------------------------------------------------------------------------------------------


if sender==30 then
	setcurentleaf("bob",23,0);
	set_visible_object(800,false)
	set_visible_object(12121,true)
	setstatemenu();
return;end;
	if sender==100 then
		if flags.rend then
			SetAlfa(-34,1,0,1);
			 flags.rend=false;
			 
			 flags.gorod= true;			
			 for i=8000,8020,1 do
				--speciale_action(2,i);
				SetAlfa(i,1,0,0.00001)
			end;
			for n=7000,7010,1 do
				speciale_action(2,n);
			end;
		end;
		
	return; end;
	if sender==33 then
	if obj_id==-40 then
		speciale_action(2,9000,true)
		speciale_action(4,9000)
	return; end;
		if obj_id==-34 then
			if not flags.gorod then
				flags.rend= true;
				WaitRender();
			return; end;
			MoveObjectY(1,-384,-200,2);
			MoveObjectY(12,768,768-200,2);
			flags.Blocking =true;
			BlockCursor(true)
			addtexttogame(1100,161,618,"260",680); 
			setcolor(1100,1,1,1,0,1); 
			speciale_action(4,1100);
		return; end;
	return; end;
	if sender==36 then
		if obj_id==123456 then
			migaem(8010,8011,0.5,123456)
		end;
		if obj_id==123457 then
			migaem(8013,8012,0.5,123457)
		end;
		if obj_id==123458 then
			migaem(8014,8015,0.5,123458)
		end;
		if obj_id==123459 then
			migaem(8017,8016,0.5,123459)
		end;		
	return;end;
	if sender==28 then---- объект доехал
		-- SetWindowText(frame)
	WriteToConsole("28 sender\n".." "..obj_id.."\n")
		if obj_id==1 then
		
		WriteToConsole("28 sender_obj_id==1\n")
			if flags.skip123  then
			BlockCursor(false);
			flags.Blocking =false;
			speciale_action(2,9000,true);
			return; end;
			if frame==3  then
			WriteToConsole("28 sender_obj_id==1_frame==3 or flags.skip\n")
				BlockCursor(false);	
				SetAlfa(-33,1,0,2.5);
				-- setstatemenu();
				-- set_menu_page(2);
				speciale_action(2,9000,true);
			return;end;
			if frame==0 then
				WriteToConsole("28 sender_obj_id==1_frame==0 \n")

				ScaleObject(62,1.3,1,2,512,384)
				perviy = true;
			return;end;	
		return;end;
			if obj_id==61 then
				if frame==2 then
					speciale_action(2,41);
					speciale_action(2,16);
					set_text(1100,"262"); 
					BlockCursor(false);
				return; end;
			return; end;		

			if obj_id==8001 then
				migaem(8013,8012,1,123457)
			return; end;

	return;end;	
---------------------------------------------------------------------------------------------------------------
	if sender==29 then -- отработал скейл
	WriteToConsole("29 sender\n".." "..obj_id.."\n")
	   if obj_id==62 then
			if flags.skip then
				setcolor(1100,1,1,1,1,1);
				speciale_action(2,42);
				speciale_action(2,11,true);
				BlockCursor(false);	
				flags.Blocking =false;				
			return;end;
	   flags.skip= true;	
	   return; end;
	   		if obj_id==8004 then
			WriteToConsole("ScaleObject gorod otrabotal\n")
			if flags.first then
						WriteToConsole("ScaleObject gorod otrabotal_na4inaem migati\n");
			migaem(8010,8011,1,123456)
			migaem(8014,8015,1,123458)
			migaem(8017,8016,1,123459)
			BlockCursor(false);	
					speciale_action(2,8002);
					speciale_action(2,8003);
					MoveObjectX(8001,-600,-274,1);	
					MoveObjectX(8012,-229-326,-229,1);	
					MoveObjectX(8013,-149-326,-149,1);	
					flags.doexal= true;
			return;end;
		return;end;
	return;end;
				if pause_state then
		if sender==1 or sender==6 or sender==14 then
			pause_state=false;
			--set_visible_object(11111,false);
		end;	
	return;end;
	if sender == 1 then --кликнули левой кнопкой мыши на активный объект
	WriteToConsole(frame)
				if obj_id==6999 then
				WriteToConsole("4enajalineponyatno")
				skipfirst= true
				addfade(-40,0);
				speciale_action(4,-40);
				SetAlfa(-40,0,1,1.5)
				-- SetAlfa(6999,1,0,1)	
				-- SetAlfa(7004,1,0,1)	
				-- SetAlfa(7000,1,0,1)	
				-- SetAlfa(6205,1,0,01)	
				-- SetAlfa(26,1,0,01)	
			return; end;
		if obj_id==11 then		    
			flags.skip123= true;
			EndComiks()
		return;end;	
		if obj_id==9000 then		    
			clear_satelite_leaf("bob");

		return;end;		
	return;end;
		if sender==6 then
			if not flags.arest and flags.doexal then
			WriteToConsole("sender 6\n")
			flags.migalka=false
				addfade(-34,0)
				speciale_action(4,-34);
				SetAlfa(-34,0,1,1)
				flags.arest= true;
				speciale_action(2,6999,true);
			end;
			if not flags.Blocking then
			WriteToConsole("1\n")
						frame=frame+1;
				if frame==1	then 
				WriteToConsole("4142\n")
					speciale_action(2,41);
					speciale_action(2,42);
					set_text(1100,"261"); 
				return;end;
				if frame==2	then 	
					MoveObjectX(61,1024,600,2);			    
					BlockCursor(true);					
				return;end;
				if frame==3	then 			    
					EndComiks()
				return;end;	
			return;end;	
		return;end;
end
function EndComiks()
	MoveObjectY(1,-200,-385,2);
	MoveObjectY(12,768-200,768,2);
	BlockCursor(true);	
		addfade(-33,0);
		SetAlfa(42,1,0,0.01)
		SetAlfa(41,1,0,0.01)
		SetAlfa(16,1,0,0.01)
		SetAlfa(11,1,0,0.01)
		SetAlfa(2,1,0,0.01)
	-- speciale_action(2,2);
	-- speciale_action(2,11);
	setcolor(1100,1,1,1,0,1);	
	SetAlfa(-33,0,1,2.5);	
end;