-- CreateConsole()
message_win_x = 160;
message_win_y = 240;
have_sbros=false;
Hanoika=false
Lazeri=false
Fontan=false
CurrP1 = nil;	CurrF1 = nil;	CurrT1 = nil;
CurrP2 = nil;	CurrF2 = nil;	CurrT2 = nil;
CurrMesPers = nil;	CurrMesText = nil;
sheet_switch_time = 3;	
	
function Timer( ncount, param1)
	if not StopSheet then
		AlfingSheet();
		StopSheet = false;
	end;
return; end;

function SetAlfaSheet( TimeAlpha )
	AlternateTimer( "Timer", TimeAlpha*1000 );
	StopSheet = false;
return; end;

------------------------------------------------ Interface -------------------------------------------------

function TakeGlove()
	if not glove_on then
	RotateWheel(342,198,270,414,126,2,3,2);		
		gloveselect=true;
glove_on = true;		
	letrotate=true;
	rotate=false;
	glove_rotate=true;
	flags.glove_1=true;
	gloveselect=true;
	end;
end;

function HideGlove()
	if declineGadjet and glove_on then
		if flags.tutorforglove then				
		flags.tutorforglove=false;			
		-- StartEmiter("Highlight");
		Set_Cursor(obj.delta_broken.id,4);	
		flags.start_podskazka	= true;
		set_visible_object(5559,false);			
		set_visible_object(obj.plashechka.id,false)
		set_visible_object(obj.goodgirl.id,false)
		del_object_from_game(5654547)	
		 flags.tutor=false;		
		end
			
		FreeCustomCursor();		
		gloveselect = false;
		RotateWheelBack(342,198,270,414,126,1.7,3,2);		
		declineGadjet=false;
		glove_on=false;
		
	end;
end;

function HideScaner()
	if declineGadjet and scaner_on then
		FreeCustomCursor();		
		scaner_on = false;
		scanerselect=false;
		RotateWheelBack(198,54,126,270,-18,1,1,0);
		declineGadjet=false;
		
	end;
end;




function HideRentgen()

	if declineGadjet and rentgenselect then
			declineGadjet=false;				
			rentgenselect=false;
			gameinput(100001,-1,-1)
			RotateWheelBack(270,126,198,342,54,1.5,2,1); 
			set_visible_object(5560,false);
			rentgen_is_usable=false;
	end;
end;

function HideNvg()


	if declineGadjet and nvgselect then
	if not flags.comics4 then
		CreatePlashechka(3442,"20002","goodgirl")
		return;end
		
		if flags.nvg_block then
			CreatePlashechka(3442,"10002","goodgirl")
		return; end;
		
		if not flags.light1 then
				CreatePlashechka(3442,"20002","goodgirl")
			
		return;end;
			
			declineGadjet=false;
			nvgselect=false;
			 set_visible_object(-100022, false); 			 
			 gameinput(1000022, -1, -1);
			
			RotateWheelBack(414,270,342,487,198,3,4,3);	 
			set_visible_object(5561,false);		
	end;
end;
------------------------------------------------------ end of list of my functions

function AddTreeLeaf( parent, leafname, level, sublevel)
	add_tree_leaf( parent, leafname, level, sublevel );
end;

function LoadLeafRes( level, sublevel )
	dofile("./data/".. level .. "/" .. sublevel .."/res.lua");
end;

function SetCurrentLeaf( leafname, level, sublevel )	
		--WriteToConsole("Save do SaveGame gamedata.curr_level"..gamedata.curr_level.."\n")
	gamedata.curr_level=level
	SaveGame1()
			--WriteToConsole("Save after SaveGame gamedata.curr_level"..gamedata.curr_level.."\n")
    set_activ_leaf( leafname, level, sublevel ); 	
    dofile("data\\"..level.."\\"..sublevel.."\\level.lua");	
    g_leafname=leafname;
    g_level=level;
    g_sublevel=sublevel;	
	nazvlevela=leafname
	
	StartAnimation( 5555555555,5,5 );
	
end;

function DeleteTreeLeaf( parent, leafname )
	delete_tree_leaf( parent, leafname );
end;

 -- CreateConsole()
imagetex=-1;

function CreatePlashechka(id,text,	-- идентификатор текста
							image,isTime	-- имя текстуры говорителя
				)

			
isTimes=isTime
imagetex=image;
imageid=id
playeffect("129")
BlockCursor(true)
	
	 function f2666()		
		a,b=GetObjectSize(obj[image].id)
		x,y=GetObjectPosition(obj[image].id)
		addtexttogame(5654547,x+a+20,y+10,text,800)
		setcolor(5654547,1,1,1,1,1)
		set_visible_object(5654547,true)
		set_text(5654547,text)
		speciale_action(4,5654547)		
		StartTimer(35523,0.2,"block")
		
		function block()
			BlockCursor(false)
		end
		
		if not isTimes then
			AlternateTimer("plashechkiGameInput1",8000)			
		end
		
	end
	
	function plashechkiGameInput1()	
			if imagetex~=-1 then		
			del_object_from_game(5654547)				
			set_visible_object(obj.plashechka.id,false)
			set_visible_object(obj[imagetex].id,false)			
			gameinput(26,id)					
			id=-1;
			imageid=-1;
			showoptions=true	
		
			if switched and not takeobjecttohand then
				SwitchToSheet("re");
				switched=false;			
			end
			end
	end	
	
	set_visible_object(100004,true)	
	NewObj("plashechka","plushka",0,0,"")
	speciale_action(4,obj.plashechka.id)
	set_visible_object(obj.plashechka.id,true)		
	if image~=nil then	
		NewObj(image,image,10,15,"")
	end
	speciale_action(4,obj[image].id)
	set_visible_object(obj[image].id,true)
	--a,b=GetObjectSize(obj.plashechka.id)
	--MoveObjectY(obj.plashechka.id,-b,0,0.15)
	--MoveObjectY(obj[image].id,-b,13,0.15)
	StartTimer(12543121212153422,0.0001,"f2666")
	
	

end


function DestroyMyWindow()
	DestroyWindow()
end
 


function CreateWindow(posx,posy,textid,windowId,image,textX,textY,item,itemX,itemY,fMethod,flTime)
playeffect("009");
  if textX==nil then textX=85 end;
  if textY==nil then textY=70 end;
  if fMethod==nil then fMethod=8 end;
  if flTime==nil then flTime=2.8 end;
  AddWindow(posx,posy,500,420,windowId,fMethod,flTime);
  AddWindowElementText(1000025,textX,textY,textid);
  c("1000025")
  if item~=nil then AddWindowElementImage(1000028,item,itemX,itemY) end;
  if image==nil
    then
      AddWindowElementImage(1000024,"window",0,0);
    else
      AddWindowElementImage(1000024,image,0,0); 
  end;
  SetWindowElementTextColor(textid,0,0,0,1);
  if imagetex~=-1 then
			set_visible_object(obj.plashechka.id,false)
			set_visible_object(obj[imagetex].id,false)
			del_object_from_game(5654547)			
	end
end;
function Dark(flag,t)
	if t == nil then
		t = 1;
	end;
	if flag == nil then
		flag = true;
	end;
	if flag then
		SetAlfa(Fade,0,0.9,t);
	else
		SetAlfa(Fade,0.9,0,t);
	end;

end;

whole_darkness = false;
function DarkScreen(todark)	
  if todark then
	if not whole_darkness then		
		whole_darkness=true
		SetAlfa(Fade,0,0.9,1);	
	return;end;
  return;end;
	if whole_darkness then	
		SetAlfa(Fade,0.9,0,1);
		whole_darkness = false;	
	end;
end;

-- CreateConsole()
function SheetSwitched (ncount)
    StopSheet=true;
	-- playeffect("014")	
	--если тутор и нужно закрыть анкету и тыкаем на шит
		if flags.dosie then					
				speciale_action(2,obj.message1.id,true)				
				flags.dosie=false	
				
		end
			
	if flags.start_arrow2 and flags.vkladka then	
			StartTimer(6635253,1,"tutor3")
			BlockCursor(true)
			function tutor3()
				speciale_action(2,obj.arrow5.id,true);
				StartAnimation(obj.arrow5.id);
				BlockCursor(false)
				playeffect("018")
				dragonfly_is_usable=true
			end
			
			flags.vkladka=false
			set_visible_object(obj.arrow2.id,false);				
			set_text(5654547,"208")			
			flags.start_arrow2=false;
			flags.start_arrow4 = false;
			flags.start_arrow5 = true;
			flags.nohints = false;				
			SwitchToSheet("re");
			takeobjecttohand=false
			flags.glove_1=false;
			flags.tutor=true;			
			flags.starthint=true			
	return;end	
return;end;
-------------------------------------------------------------------------------------------------------------------


function AddTool()
		flags.havetool=true
		SetCurrentRM("menu");
		loadresource("data\\ingame\\sheet_buttons.png","sheet_buttons");
		addstaticobjecttogame(777777777,"sheet_buttons",0,0,"",0,0,61,61);
		
		AddSheet(1001,"gr","",135,705,70,70,"green",182,655,681,91,50,30,18,20,1,56,777777777,8);
		AddLeftScroller("gr",101,"scroll_l",nil,nil,nil,813,155,14,26);  -- draw over scene
		AddRightScroller("gr",102,"scroll_r",nil,nil,nil,828,155,14,26); -- draw over scene
		SetCurrentRM("main");		
end;
function AddTxt()
	SetCurrentRM("menu");
	loadresource("data\\ingame\\sheet_buttons.png","sheet_buttons");
	addstaticobjecttogame(877777777,"sheet_buttons",0,0,"",62,0,61,61);
	
	AddSheet(1002,"re","",160,650,61,61,"",183,660,600,105,55,15,4,4,0,59,877777777);
	SetCurrentRM("main");
end;

function CreateCommonObjects( level_num,yes )	

	loadresource("data\\arrow.png","arrowww");
	NewObj("myarrow",  "arrowww", -1000,-1000, "");
	speciale_action(4,obj.myarrow.id)
	NewObj("dragonfly", "dragonfly", -80, 650, "");
	speciale_action( 4, obj.dragonfly.id );		
	BlockCursor(true)
	DrawClosedPlushes();	
	loadresource("data\\" .. level_num .. "\\0\\Intro.png","intro",1006);
	addstaticobjecttogame(NewId("intro"),"intro", 130, 316, "");
	speciale_action( 4, obj.intro.id );
	set_visible_object(obj.intro.id, false);		
	addfade(666555444,0.7);
	speciale_action(4,666555444);
	StartTimer(4321143,1,"StartLevel")	
	
	NewObj( "glove", "glove", -100, -100, "" );	
	NewObj( "pointer", "pointer", -100, -100, "" );
	NewObj( "scaner", "scaner", -100, -100, "" );
	-- end glove --

return; end;

function CreateCommonObjects1 ()
		loadresource("data\\images\\level_complete.png","completed",1007);
	NewObj("completed", "completed", 200, 330, "");
	set_pixel_check(obj.completed.id, false);
	speciale_action( 4, obj.completed.id );
	set_visible_object(obj.completed.id, false);
	
end

function EndMiniSkipLoading()	
	ActivateObject( obj.mini_skip1.id, true );	
	canskip=true;
end;
canskip=false;
function CreateMiniOutfit()
AlternateTimer("Blockbeforestartmini",2100)
BlockCursor(true)

function Blockbeforestartmini()
	BlockCursor(false)	
end

	finish=false
	
	if not Hanoika and not Fontan and not Lazeri then 
		playeffect("025")
	end
	
	
	NewId("mini_skip_loading");
	add_animation(obj.mini_skip_loading.id);
	add_animation_frame(obj.mini_skip_loading.id,"mini_skip_loading",18,721,0,0,58, 13,20);
	add_animation_frame(obj.mini_skip_loading.id,"mini_skip_loading",18,721,0,13,58,13,20);
	add_animation_frame(obj.mini_skip_loading.id,"mini_skip_loading",18,721,0,26,58,13,20);
	add_animation_frame(obj.mini_skip_loading.id,"mini_skip_loading",18,721,0,39,58,13,0.1);
	AddFrameFunc(obj.mini_skip_loading.id, "EndMiniSkipLoading");

	NewObj( "mini_menu2", "mini_button", 907, 2, "",0,0,0,0,116,47);
	NewObj( "mini_help2", "mini_button", 2, 2, "", 0, 0, 255, 0, 116, 47 );	
	NewObj("mini_skip2", "mini_button", 2, 705, "",0,0,384,0,233,47 );
	
	if have_sbros then
	 NewObj("mini_sbros2", "mini_button", 890, 705, "",0,0,127,0,116,47 );
	 OnMouseOver(obj.mini_sbros2.id)
	 NewObj("mini_sbros1", "mini_button", 890, 705, "",0,0,127,52,116,47 );
	 set_visible_object(obj.mini_sbros1.id,false)
	 NewObj("mini_sbros", "mini_button", 890, 705, "",0,0,127,103,116,47 );
	 set_visible_object(obj.mini_sbros.id,false)	 
	 end
	 
	
	
	NewObj( "mini_menu1", "mini_button", 907, 2, "",0,0,0,52,116,47);
	NewObj( "mini_help1", "mini_button", 2, 2, "", 0, 0, 255, 52, 116, 47 );	
	NewObj("mini_skip1", "mini_button", 2, 705, "",0,0,384,52,233,47 );
	
	set_visible_object(obj.mini_menu1.id,false)
	set_visible_object(obj.mini_help1.id,false)
	set_visible_object(obj.mini_skip1.id,false)
	
	NewObj( "mini_menu", "mini_button", 907, 4, "",0,0,0,103,116,47);
	NewObj( "mini_help", "mini_button", 2, 4, "", 0, 0, 255, 103, 116, 47 );	
	NewObj("mini_skip", "mini_button", 3, 705, "",0,0,384,103,233,47 );	
	
	set_visible_object(obj.mini_menu.id,false)
	set_visible_object(obj.mini_help.id,false)
	set_visible_object(obj.mini_skip.id,false)	
	OnMouseOver(obj.mini_menu2.id)
	OnMouseOver(obj.mini_help2.id)
	OnMouseOver(obj.mini_skip2.id)	
	
	OnMouseOver(obj.mini_menu.id)
	OnMouseOver(obj.mini_help.id)
	OnMouseOver(obj.mini_skip.id)	
	
	OnMouseOver(obj.mini_menu1.id)
	OnMouseOver(obj.mini_help1.id)
	OnMouseOver(obj.mini_skip1.id)	
	addstaticobjecttogame(	NewId("mini_border"), "mini_border", 0, 0, "" );
	
	ActivateObject( obj.mini_skip1.id, false );
	
end;
navedenie=-1;
-- CreateConsole()
butt=nil;
finish=false
function MiniInterfaceHandler( event, obj_id ) 
c("\nevent= "..event.."\n")


	if event == 6 then		
	
		if butt == obj.mini_skip1.id and canskip then	
				playeffect("019")
				flags.mini_complete=true
				finish_mini_game(true);		
				finish=true
				
		end
		
		if butt == obj.mini_help1.id  then	
		playeffect("020")					
			set_visible_object(obj.mini_help2.id,true)		
			set_visible_object(obj.mini_help1.id,false)			
			set_visible_object(obj.mini_help.id,true)		
			navedenie=obj.mini_help.id		
			speciale_action(4,obj.mini_help.id)				
			butt=-1;	
			if mini2lvl then 			CreateWindow(CWX,CWY,"666",87878787,nil,170,250);				return end				
			if mini2lvl5 then 			CreateWindow(CWX,CWY,"668",87878787,nil,100,230);				return end		
			if mini2lvl6 then 			CreateWindow(CWX,CWY,"667",87878787,nil,100,230);				return end			
			if mini1lvl10 then 			CreateWindow(CWX,CWY,"666",454,nil,100,195);					return end		
			if mini2lvl10 then 			CreateWindow(CWX,CWY,"667",754,nil,100,230);					return end		
			if mini1lvl16 then 			CreateWindow(CWX,CWY,"666",754,nil,100,190);	 				return end		
		
			CreateWindow(CWX,CWY,"666",87878787,nil,100,230);			
		end
		
		if butt == obj.mini_menu1.id then
				showoptons()
				playeffect("021")
				set_visible_object(obj.mini_menu2.id,true)
				set_visible_object(obj.mini_menu1.id,false)
		end
		
		if have_sbros and butt == obj.mini_sbros1.id then
			set_visible_object(obj.mini_sbros2.id,true)
			set_visible_object(obj.mini_sbros1.id,false)
			gameinput(66)			
		end
				
			 if navedenie==-1 then
				set_visible_object(obj.mini_help2.id,true)
				set_visible_object(obj.mini_menu2.id,true)			
				speciale_action(4,obj.mini_help2.id)	
				speciale_action(4,obj.mini_menu2.id)	
			 end
			--	speciale_action(4,obj.mini_help.id)	
	 end;
	
		if event == 5 then
		
		
	if navedenie == obj.mini_skip.id then		
			set_visible_object(obj.mini_skip1.id,true)
			set_visible_object(obj.mini_skip.id,false)
			butt=obj.mini_skip1.id
	end	
	if navedenie == obj.mini_help.id then	
			 set_visible_object(obj.mini_help1.id,true)
			 speciale_action(4,obj.mini_help1.id)
			 set_visible_object(obj.mini_help.id,false)
			  set_visible_object(obj.mini_help2.id,false)
			butt=obj.mini_help1.id
	end
	if navedenie == obj.mini_menu.id then		
			set_visible_object(obj.mini_menu1.id,true)
			set_visible_object(obj.mini_menu.id,false)
			butt=obj.mini_menu1.id
	end;
	
	if have_sbros and navedenie == obj.mini_sbros.id then		
			set_visible_object(obj.mini_sbros1.id,true)
			set_visible_object(obj.mini_sbros.id,false)
			butt=obj.mini_sbros1.id
	end;
		
	 end;
	
	if event == 33 then
		if not start_anima then
			StartAnimation( obj.mini_skip_loading.id, 0, 3 );
			start_anima=true
		end
	end;
	
	if event ==1  then	
	
	if navedenie == obj.mini_skip.id then		
			set_visible_object(obj.mini_skip1.id,true)
			set_visible_object(obj.mini_skip.id,false)
			butt=obj.mini_skip1.id
	end	
	if navedenie == obj.mini_help.id then	
			 set_visible_object(obj.mini_help1.id,true)
			 speciale_action(4,obj.mini_help1.id)
			 set_visible_object(obj.mini_help.id,false)
			  set_visible_object(obj.mini_help2.id,false)
			butt=obj.mini_help1.id
	end
	if navedenie == obj.mini_menu.id then		
			set_visible_object(obj.mini_menu1.id,true)
			set_visible_object(obj.mini_menu.id,false)
			butt=obj.mini_menu1.id
	end;
	
	if have_sbros and navedenie == obj.mini_sbros.id then		
			set_visible_object(obj.mini_sbros1.id,true)
			set_visible_object(obj.mini_sbros.id,false)
			butt=obj.mini_sbros1.id
	end;
	
	end
		
	
	if event==35 and not finish then
	
		if obj_id==obj.mini_menu2.id then		
			set_visible_object(obj.mini_menu2.id,false)
			set_visible_object(obj.mini_menu1.id,false)
			set_visible_object(obj.mini_menu.id,true)
			navedenie=obj.mini_menu.id
			speciale_action(4,obj.mini_menu.id)
		end
		
		
		if obj_id==obj.mini_help2.id then
		set_visible_object(obj.mini_help2.id,false)
		 set_visible_object(obj.mini_help.id,true)
		navedenie=obj.mini_help.id
		speciale_action(4,obj.mini_help.id)
		end
		
		if obj_id==obj.mini_skip2.id  then
			navedenie=obj.mini_skip.id
			if canskip then
		set_visible_object(obj.mini_skip2.id,false)
		set_visible_object(obj.mini_skip.id,true)
		
		speciale_action(4,obj.mini_skip.id)
		speciale_action(4,obj.mini_skip_loading.id)
			end
		end	
		
		if have_sbros and obj_id==obj.mini_sbros2.id then	
		set_visible_object(obj.mini_sbros2.id,false)
		 set_visible_object(obj.mini_sbros.id,true)
		 navedenie=obj.mini_sbros.id
		 speciale_action(4,obj.mini_sbros.id)
		end
		
	
	end
	
	if event==39 then
		c("gm")
	butt=-1;		
	navedenie=-1;
		if obj_id==obj.mini_menu.id then
			set_visible_object(obj.mini_menu2.id,true)
			set_visible_object(obj.mini_menu.id,false)
		end
		if obj_id==obj.mini_help.id then
			set_visible_object(obj.mini_help2.id,true)
			set_visible_object(obj.mini_help.id,false)
			c("\nEEEEEEEEEEEE\n")
		end
		if obj_id==obj.mini_skip.id then
			set_visible_object(obj.mini_skip2.id,true)
			set_visible_object(obj.mini_skip.id,false)
		end
		if have_sbros and obj_id==obj.mini_sbros.id then
			set_visible_object(obj.mini_sbros2.id,true)
			set_visible_object(obj.mini_sbros.id,false)
		end
	end
end; -- MiniInterfaceHandler()
-- CreateConsole()
function ProgressBar()
StopAllEffects()
-- DeleteRenderTarget(2234)  					 
-- leafobj={}
if flags.mini0 then
	clear_satelite_leaf("peak");
return;end
if flags.mini19 then
	clear_satelite_leaf("vhod_olimp");
return;end
if flags.mini20 then
	clear_satelite_leaf("olimp");
return;end

if flags.mini27 then
	clear_satelite_leaf("dark_cave");
return;end
c("nazvlevela = "..nazvlevela)

-- DeleteRenderTarget(2234)  
delete_tree_leaf("Root",nazvlevela);	
NextLevel(30)
-- c("progress bar")	
end

function FadeBlack1()	
	addfade(666555444,0);
	speciale_action(4,666555444);
	SetAlfa(666555444,0,0.6,1.5,"TimerForNextLevel");	
end;

function FadeBlack2()	
	addfade(666555444,0.6);
	speciale_action(4,666555444);
	-- ReturnHiddenObjects()  
	-- DeleteRenderTarget(2234)  			
	-- leafobj={}	
	SetAlfa(666555444,0.6,1,1.5,"ProgressBar");	
end;

function StartLevel()	
c("start SetAlfa, start Scale \n")
onmenu = true

	SetAlfa(666555444,0.7,0,1.5,"sender28");
	ScaleObject(obj.intro.id,1,0,2,360,70)
	-- StopEmiter( "Level" );
	playeffect("127")
	speciale_action(10,obj.intro.id)	
	c("speciale_action 10 \n")

	
end;

function sender28 ()

c("\n sender 28")
StartTimer(24242342,2,"SMenu")
function SMenu()
 onmenu=false
end

gameinput(28,top_plush_id)
gameinput(777)

-- del_object_from_game(obj.intro.id)
c("\n dell obj intro\n")
-- gameinput(100)
-- WaitRender()
flags.first_time_load=false;

BlockCursor(false)
SwitchToSheet("re")
podlojka() --подложка под текст
c("\n podlojka\n")
end



function LevelEnd(nextlevel11)
if not cangotothenextlevel then
HideGlove()
HideNvg()
HideScaner()
cangotothenextlevel= not cangotothenextlevel;
loadresource("data\\images\\level_complete.png","completed",1007);
addstaticobjecttogame(NewId("completed"), "completed", 180, 300, "");
set_pixel_check(obj.completed.id, false);
speciale_action( 4, obj.completed.id );
showoptions=false;
BlockCursor(true)
set_visible_object(top_plush_id,false)
set_visible_object(bottom_plush_id,false)
nextlevel=nextlevel11;
FadeBlack1()	
flags.start_draw = false;
flags.finish = true;
speciale_action( 4, obj.completed.id );
set_visible_object( obj.completed.id, true );
ShowMenu(false);	
ScaleObject(obj.completed.id,0.6,1,2,270,45)
playeffect("128")


function TimerForNextLevel()
StartTimer(98765,2,"nextlvl")
end
function nextlvl()
FadeBlack2()
end
end
end


function c(str)
WriteToConsole(str)
end
function c1(str)
WriteToConsole(tostring(str))
end

RegisterSaveFunction("SaveGame1")

function vasea3353523()


end


function rendertar(tex_name,tex_id)

FlipVertical(2234);
SetObjectPosition(2234,0,-256);
LeaveObjectsOnReder("leafobj");
SetAlfa(2234,0,1,0,"vasea3353523")
ShowMenu(false)
if	not minigg then
	c("ministart")
	start_anima=false
	mini_start=true;
	add_free_leaf(mininame,mininum1,mininum2);
	set_satelite_leaf(mininame2);	
	UpdateStack()	
	dofile("./data/"..mininum1.."/"..mininum2.."/".."res.lua");
	dofile("data\\"..mininum1.."\\"..mininum2.."\\level.lua");	
	mini_create();----------
else
LevelEnd(levelnext)
end
return end
-- CreateConsole()

function podlojka()
loadresource("data\\podlojka.png","podlojka");	
CreateTextBackground("podlojka",0,0,40,46)
end


SetShtrafFunc("Shtraf",4,2)
function Shtraf()

if takeobjecttohand then return;end
	--FreezeCursor(true);
	x,y=GetCursorPos()
	ShowCursor(false)
	set_visible_object(obj.myarrow.id,true)
	speciale_action(4,obj.myarrow.id)
	BlockCursor(true)
	playeffect("015")

if x>-100 and x<500 and y>-100 and y<300 then
	StartTravel(obj.myarrow.id,1,"Misc.dll",nil,{"InstantiationOfCurve",4,20,100,x,y,0,22,0.4,0,2,true},"enfofshtraf")
end

if x>500 and x<1500 and y>-100 and y<300 then
	StartTravel(obj.myarrow.id,1,"Misc.dll",nil,{"InstantiationOfCurve",4,-20,100,x,y,0,22,0,0,2,true},"enfofshtraf")
end

if x>-100 and x<500 and y>300 and y<900 then
	StartTravel(obj.myarrow.id,1,"Misc.dll",nil,{"InstantiationOfCurve",4,20,100,x,y,0,22,-0.4,0,2,true},"enfofshtraf")
end

if x>500 and x<1500 and y>300 and y<900 then
	StartTravel(obj.myarrow.id,1,"Misc.dll",nil,{"InstantiationOfCurve",4,-20,100,x,y,0,22,0,0,2,true},"enfofshtraf")
end

	function enfofshtraf()
		x1,y1=GetObjectPosition(obj.myarrow.id)
		u,v=GetCursorPos()
		
		
		SetCursorPos(x1,y1)
		ShowCursor(true)
		BlockCursor(false)
		u1,v1=GetCursorPos()
		WriteToConsole("Object: ("..x.."; "..y..") --->\nCursor after: ("..u1.."; "..v1..") ---> object after: ("..x1.."; "..y1..")\n")
		set_visible_object(obj.myarrow.id,false)
		SetObjectPosition(obj.myarrow.id,-1000,-1000)
		--FreezeCursor(false)
	end
end
-- CreateConsole()
-- c("lvl 8")