function SelectRandom()
  if not obj.napiln.is_collapsed and flags.ugon_auto then
    selectrandomobject1(1.5,obj.napinl.id,false); --напильник
  return; end;
  if not flags.hidden_rubka then
    selectrandomobject1(1.5,11,false); --рубка
  return; end;
  if not flags.conteiner and obj.maslen~=nil and obj.maslen.is_collapsed then 
    selectrandomobject1(1.5,4,false); --контейнер
  return;end;  
  if (not flags.is_coleso) and obj.koleso~=nil and obj.koleso.is_collapsed and obj.bolts~=nil and obj.bolts.is_collapsed and obj.balkey~=nil and obj.balkey.is_collapsed then
  selectrandomobject1(1.5,18,false);
  return;end;
  if (flags.auto or flags.is_coleso)and not flags.ugon_auto then
    selectrandomobject1(1.5,19,false); --машина
  return; end;
  if flags.ugon_auto and not flags.luk_parom and obj.fomka~=nil and obj.fomka.is_collapsed then
    selectrandomobject1(1.5,10,false); --люк закрытый
  return; end;
  if not flags.motor and flags.luk_parom and obj.knstro~=nil and obj.knstro.is_collapsed then
    selectrandomobject1(1.5,9,false); --мотор
  return; end;
  if flags.motor and flags.lebedka and flags.john_day_book then
    selectrandomobject1(1.5,20,false); --в тюрьму
  return;end;
   not_hint=true
CreatePlashechka(900000,"10005")
return;end;

function SetCursors()
    ItemsCur={}
    PointingItems={}
    Set_Anim_Cur(16,12);
    if not obj.napiln.is_collapsed and flags.ugon_auto then
        Set_Anim_Cur(obj.napinl.id,4);
    end;
    if not flags.is_coleso then
        Set_Anim_Cur(18,2);
    end;
    if not flags.hidden_rubka then
        Set_Anim_Cur(11,2);
    end;
    if flags.motor then
        Set_Anim_Cur(9,3);
      Set_Anim_Cur(20,14);
    end;
    if (flags.auto or flags.is_coleso) and not flags.ugon_auto then
      Set_Anim_Cur(19,2);
    end;
    if not flags.luk_parom and flags.ugon_auto then
      Set_Anim_Cur(10,2);
    end;
    if flags.luk_parom and not flags.motor then
      Set_Anim_Cur(10,3);
      Set_Anim_Cur(9,2);
    end;
    if not flags.conteiner then
        Set_Anim_Cur(4,2);
    end;
end;

function SetParticles()
    if flags.motor then
      AddParticleToObject(20,"perehod",166,138);
      MoveEmiter("perehod",166,138);
      StartEmiter("perehod"); 
      playeffect("parom",true);
    end;
    if not flags.is_coleso then
      AddParticleToObject(18,"vepr",502,279);
      MoveEmiter("vepr",502,279);
      StartEmiter("vepr");
    end;
    if (flags.auto or flags.is_coleso)  then
          StopEmiter("vepr");
          AddParticleToObject(19,"ugon_auto",574,189);
          MoveEmiter("ugon_auto",574,189);
          StartEmiter("ugon_auto");
    end;
    if flags.ugon_auto and not flags.motor then
      AddParticleToObject(1,"jama",616,258);
      MoveEmiter("jama",616,258);
      StartEmiter("jama");
    end;
        
    if not flags.luk_parom and flags.ugon_auto and not flags.motor  then
--	messagebox(1)
      AddParticleToObject(10,"jama",616,258);
      MoveEmiter("jama",616,258);
      StartEmiter("jama"); 
    end;
    if flags.luk_parom and not flags.motor  then
	--messagebox(2)
      AddParticleToObject(9,"jama",616,258);
      MoveEmiter("jama",616,258);
      StartEmiter("jama");  
    end;
    if not flags.conteiner then
      AddParticleToObject(4,"conteiner",394,418);
      MoveEmiter("conteiner",394,418);
      StartEmiter("conteiner");
    end;
    if not flags.hidden_rubka then
      AddParticleToObject(11,"rubka",145,253);
      MoveEmiter("rubka",145,253);
      StartEmiter("rubka");
    end;
    if not obj.napinl.is_collapsed and flags.ugon_auto then
      AddParticleToObject(obj.napinl.id,"pism",725,325);
      MoveEmiter("pism",725,325);
      StartEmiter("pism");
    end;
end;

function ActionsJump ()
    
end;

function gameinput (sender,obj_id,attachedID)  
    CursorTreatment(obj_id,sender,attachedID); 
  if sender==33 then
      Block_Show_Cur(false);
  return;end; 
  
  if sender==100 then
    SetParticles()
    SetCursors()
    BlockCursor(false)
    playeffect("fon_see",true);
    if not  flags.first_parom then
    flags.first_parom=true
    CreatePlashechka(900000,"3044")
    end;
    
    if flags.is_hidden_finish then
        flags.is_hidden_finish=false
        ActivateObject(11,false);
        Set_Anim_Cur(11,3);
    end;
    if fromkoleso then
        if not     flags.first_auto_visible then
          speciale_action(2,8,true,2);
          speciale_action(2,7,true,2);
          speciale_action(2,18);
          speciale_action(2,19);
          Set_Anim_Cur(19,2);
          StopEmiter("vepr");
          AddParticleToObject(19,"ugon_auto",574,189);
          MoveEmiter("ugon_auto",574,189);
          StartEmiter("ugon_auto");
          flags.first_auto_visible = true;
        end;    
        -- IsMiniGame=true    
        -- fromkoleso=false
        -- Set_Sat("ugon",10,11,"parom_main")    
    end;
    if fromopenluk then
        fromopenluk=false
        ActivateObject(10,false);
          Set_Anim_Cur(10,3);
          speciale_action(2,9,true);
          ActivateObject(9,true);
          Set_Anim_Cur(9,2);    
    end;
  return;end;
  
  if sender==16 then
      if obj_id==81 then
        speciale_action(2,81,true,3.7)
        speciale_action(2,83,true,4)      
      end;
      if obj_id==82 then
        speciale_action(2,82,true,3.7)
        speciale_action(2,80,true,4)      
      end;
      if obj_id==83 then
        speciale_action(2,83,true,3.7)
        speciale_action(2,81,true,4)            
      end;
      if obj_id==80 then
        speciale_action(2,80,true,3.7)
        speciale_action(2,82,true,4)
      end;  
  return;end;
  
  
  if sender == 1 then
 
    g_attachedID = attachedID;
  
    if obj_id == 20 then
      if not flags.lebedka or not flags.john_day_book or not flags.motor then
      CreatePlashechka(900000,"321")
      return; end; 
      if not flags.comics6 then
      neighbors.comics6.lock=false;
        LoadLocation("comics6");
      Block_Show_Cur(true)
      StartTimer(876876,1)
      end;
  
    return; end;
    if obj_id == 9 and not flags.motor then
        RemObjFromMouse()
        if flags.obj1017 and flags.obj1016 and flags.obj1013 and flags.obj1015 then
                s_obj=attachedID    
        end;    
        IsMiniGame=true
        Set_Sat("motor",10,12,"parom_main")
    return; end;
    if obj_id == obj.napinl.id then
      if flags.ugon_auto then
      RemObjFromMouse()         
      StopEmiter("pism");
      Set_Anim_Cur(obj.napiln.id,3)
      StoreObj(obj.napiln.id,obj_id,"209",335,350,"napilnik",280,220)
      else
         CreatePlashechka(900000,"3026")
      end;
    return; end;
    if obj_id == 16 then
       flags.is_jumping = false;
       playeffect("step_street")
       RemObjFromMouse()        
       jump("parom_main","parom",9,0);
    return; end;
    if obj_id == 11 then
    if not flags.hidden_rubka then
      flags.is_hidden_loc = true;
      RemObjFromMouse()  
      jump("parom_main","rubka",10,1);
    return; end;
    return; end;
    if obj_id == 19 and flags.auto then
        RemObjFromMouse()
        s_obj=attachedID    
        IsMiniGame=true        
        Set_Sat("ugon",10,11,"parom_main")
    return; end;
    if obj_id == 10 then
        if not flags.luk_parom then
            RemObjFromMouse()
            s_obj=attachedID    
            Set_Sat("luc_parom",10,4,"parom_main")
        return;end;
            RemObjFromMouse()
            s_obj=attachedID    
            Set_Sat("motor",10,12,"parom_main")        
    return; end;
    if obj_id == 18 or (obj_id == 19 and not flags.auto )then
        RemObjFromMouse()
        s_obj=attachedID    
        Set_Sat("auto",10,3,"parom_main")
    return; end;
    
    if obj_id == 2 or obj_id == 3 or obj_id == 4 then
        RemObjFromMouse()
        s_obj=attachedID     
        Set_Sat("conteiner",10,2,"parom_main")    
    return; end;
  return; end;
  
if sender == 36 then  
    if obj_id==876876 then
        if not flags.comics6 then
            flags.comics6 = true;         
            neighbors.prichal_turmy.lock=false;
            flags.is_comics = true;
            RemObjFromMouse()
            jump("parom_main","comics6",10,50)        
        return; end;        
    return;end;
    if obj_id==1223 then
        StartTimer(1223,30)
        StartTravel(122,1,nil,nil,flySeagulp);
    return;end;    
    if obj_id == 888888 then
        RemObjFromMouse()
        jump("parom_main","prichal_turmy",12,0);
    return; end;
return; end;
  
end
function SheetSwitched(nCount)
end;