function SelectRandom()
  if not obj.kosa.is_collapsed then
    selectrandomobject1(1.5,obj.koas.id,false); --коса
  return; end;
  if (not flags.hidden_metall) or (flags.zavareno and not flags.hidden_metall_dwa) then
    selectrandomobject1(1.5,3,false); --хидден
  return; end;  
   if not flags.turma_zamok then
    selectrandomobject1(1.5,5,false); --чулан
  return; end; 
  if flags.turma_zamok and not flags.kusty and  obj.sadnog~=nil and obj.sadnog.is_collapsed then
     selectrandomobject1(1.5,6,false); --чулан
  return;end;
  if not flags.generator and flags.turma_zamok and  obj.solar~=nil and obj.solar.is_collapsed then
    selectrandomobject1(1.5,7,false); --чулан
  return; end;  
   not_hint=true
CreatePlashechka(900000,"10005")
return;end;

function SetCursors()
    ItemsCur={}
    PointingItems={}
    if (not flags.hidden_metall) or (flags.zavareno and not flags.hidden_metall_dwa) then    
        Set_Anim_Cur(3,2);
    end;
    Set_Anim_Cur(9,11);
    if not obj.kosa.is_collapsed then
        Set_Anim_Cur(obj.koas.id,4);
    end;
    if not flags.turma_zamok then
    Set_Anim_Cur(5,2);
    end;
    if flags.turma_zamok then
      Set_Anim_Cur(11,16);
      if not flags.kusty then
        Set_Anim_Cur(6,2);
      end;
      if not flags.generator then
      Set_Anim_Cur(7,2);
      end;
    end;
end;


function SetParticles()
    if flags.generator then
      AddParticleToObject(42,"electro",50,178);
      MoveEmiter("electro",80,178);
      StartEmiter("electro");
      AddParticleToObject(4,"smoke",603,375);
      MoveEmiter("smoke",603,375);
      StartEmiter("smoke"); 
    end; 
    if flags.turma_zamok then
      if not flags.kusty then
        AddParticleToObject(6,"kusty",785,415);
        MoveEmiter("kusty",785,415);
        StartEmiter("kusty");
      end;
      if not flags.generator then
        AddParticleToObject(7,"generator",632,403);
        MoveEmiter("generator",632,403);
        StartEmiter("generator");
      end;
    end;
    if not obj.koas.is_collapsed then
      AddParticleToObject(obj.koas.id,"molot",512,539);
      MoveEmiter("molot",512,539);
      StartEmiter("molot");
    end;
    if not flags.hidden_metall then
      AddParticleToObject(3,"rubka",142,637);
      MoveEmiter("rubka",142,637);
      StartEmiter("rubka");
    end;
    if not flags.turma_zamok then
      AddParticleToObject(5,"zamok_turmy",698,391);
      MoveEmiter("zamok_turmy",698,391);
      StartEmiter("zamok_turmy");
    end;
    if flags.hidden_reshetka and  (flags.zavareno and not flags.hidden_metall_dwa) then
      ActivateObject(3,true);
      AddParticleToObject(3,"rubka",142,637);
      MoveEmiter("rubka",142,637);
      StartEmiter("rubka");
    end;
end;

function ActionsJump ()
    
end;

function gameinput (sender,obj_id,attachedID)  
CursorTreatment(obj_id,sender,attachedID);
WriteToConsole("sender= "..sender.."\n")

  if sender==8 then
    FreeObjectFromCursor()
    flags.Obj_In_Cur=false
  return;end;
  
  if sender==33 then
      Block_Show_Cur(false);
  return;end; 
  
  if sender==100 then
   
   SetParticles()
   SetCursors()
   BlockCursor(false)
   if flags.generator then
    playeffect("generator",true);
   else
    playeffect("fon_street",true);
   end;
   if fromcomics7 then
      fromcomics7=false  
      CreatePlashechka(900000,"401")
   end;
   if flags.is_hidden_finish then
        flags.is_hidden_finish=false
        ActivateObject(3,false);
        Set_Anim_Cur(3,3);
   end;
  return;end;

  if sender==16 then
    if obj_id==17 then
        speciale_action(2,17,true,3.3)
        if direct_gate=="left" then
            speciale_action(2,16,true,3.5)
        else
            speciale_action(2,19,true,3.5)
        end;
    return;end;
    
    if obj_id==16 then
        direct_gate="right" 
        speciale_action(2,16,true,3.3)
        speciale_action(2,17,true,3.5)
    return;end;
    
    if obj_id==19 then
        direct_gate="left" 
        speciale_action(2,19,true,3.3)
        speciale_action(2,17,true,3.5)    
    return;end;    
  return;end;

  
  if sender == 1 then
    g_attachedID = attachedID;
    if obj_id == 11 then
        RemObjFromMouse()
      if not flags.comics7 then
        ShowMenu(false)
        RemObjFromMouse()
        flags.is_comics=true              
        jump("vhod_turmy","comics7",13,50)
        flags.comics7 = true;
      return; end;
        playeffect("step_street")
        RemObjFromMouse()        
        jump("vhod_turmy","jmp_turma",50,3);
    return; end;
    if obj_id == 9 then
        playeffect("step_street")
        RemObjFromMouse()    
        jump("vhod_turmy","prichal_turmy",12,0);
    return; end;
    if obj_id == 3 then
        if (not flags.hidden_metall) or (flags.zavareno and (not flags.hidden_metall_dwa)) then
            flags.is_hidden_loc = true;
            RemObjFromMouse()  
            jump("vhod_turmy","metall",13,1);
        return; end; 
    return; end;
    if obj_id == obj.koas.id then
      RemObjFromMouse()
      StopEmiter("molot");
      StoreObj(obj.kosa.id,obj_id,"326",285,350,"koas",323,217)       
    return; end;
    if obj_id == 5 then
        RemObjFromMouse()
        IsMiniGame=true        
        Set_Sat("zamok_turmy",13,11,"vhod_turmy")    
    return; end;
    if obj_id == 6 then
        RemObjFromMouse()
        s_obj=attachedID    
        Set_Sat("kusty",13,2,"vhod_turmy")    
    return; end;
    if obj_id == 7 and not flags.generator then
        RemObjFromMouse()
        s_obj=attachedID    
        Set_Sat("generator",13,3,"vhod_turmy")    
    return; end;
  return; end;
  
  
end
function SheetSwitched(nCount)
end;