if flags.postavilBaraban then
  speciale_action(2,5)
end

if flags.postavilPruzhynu then
  speciale_action(2,6)
end

if flags.postavilRuchku then
  speciale_action(2,7)
end

if flags.muzFoto then
  ActivateObject(7,false)
  speciale_action(2,5)
  speciale_action(2,6)
  speciale_action(2,7)
  speciale_action(2,1)
  speciale_action(2,2)
  speciale_action(2,8)
end

local n = 0
local muzActive = false
local toClose = false

if flags.postavilBaraban and flags.postavilPruzhynu and flags.postavilRuchku then
  set_visible_object(10,false)
  muzActive = true
end

function gameinput (sender,obj_id,attachedID)
  MiniInterfaceHandler(sender, obj_id);
  sendersProcessing(sender, obj_id, attachedID);
  if wrongItemWarning(sender, obj_id, attachedID, "baraban_10_12", "ruchka_11_10", "pruzhyna_10_11") then
    return
  end
  if sender==1 then
    if obj_id == 10 then
      if obj.baraban_10_12 and attachedID == obj.baraban_10_12.id then
        removeFromMouse()
        UnStoreObj(obj.baraban_10_12.id)
        flags.postavilBaraban = true
        playeffect("muz_in")
        Block_Show_Cur(true)
        speciale_action(2,5,true,1)
        StartTimer(timerID,1.1,"unBlock_Show_Cur")
      elseif obj.ruchka_11_10 and attachedID == obj.ruchka_11_10.id then
        if flags.postavilPruzhynu then
          removeFromMouse()
          UnStoreObj(obj.ruchka_11_10.id)
          flags.postavilRuchku = true
          playeffect("muz_in")
          Block_Show_Cur(true)
          speciale_action(2,7,true,1)
          StartTimer(timerID,1.1,"unBlock_Show_Cur")
        else
          CreatePlashechka("643")
        end
      elseif obj.pruzhyna_10_11 and attachedID == obj.pruzhyna_10_11.id then
        removeFromMouse()
        UnStoreObj(obj.pruzhyna_10_11.id)
        playeffect("muz_in")
        flags.postavilPruzhynu = true
        Block_Show_Cur(true)
        speciale_action(2,6,true,1)
        StartTimer(timerID,1.1,"unBlock_Show_Cur")
      else
        CreatePlashechka("642")
      end
      if flags.postavilBaraban and flags.postavilPruzhynu and flags.postavilRuchku then
        speciale_action(2,10,true,0.1)
        CreatePlashechka("645")
        muzActive = true
      end
    end
    if obj_id == 7 then
      if muzActive then
        Block_Show_Cur(true)
        speciale_action(2,7,true,0.25)
        speciale_action(2,4,true,0.25)
        playeffect("muz_play")
        StartTimer(timerID,0.26,"frame1")
        flags.muzFoto = true
        flags.DetskayaHidden2=true
        if neighbors.DetskayaHidden.lock then
          neighbors.DetskayaHidden.lock = false
        else
          flags.hidden10_1 = true
        end


      else
        CreatePlashechka("612")
      end
    end
    if obj_id == 1 then
      speciale_action(2,9,true,1)
      setCursor(1,3)
        Journal:addText(10,"9018",154,111,330)
        Journal:addText(10,"9019",542,121,330)
        Journal:addPicture(10,"page10",122,223,0,0,777,388);        
    end
    if obj_id == 9 then
      CreatePlashechka("631")
      ActivateObject(9,false)
      toClose = true
    
      neighbors.Muz.lock = true
    end
  end
  if sender == 121 then
    if toClose then
      CloseSatelite()
    end
  end
end

function frame1()
  speciale_action(2,4,true,0.25)
  speciale_action(2,3,true,0.25)
  StartTimer(timerID,0.26,"frame2")
end

function frame2()
  speciale_action(2,3,true,0.25)
  speciale_action(2,2,true,0.25)
  StartTimer(timerID,0.26,"frame3")
end

function frame3()
  speciale_action(2,7,true,0.25)
  speciale_action(2,2,true,0.25)
  StartTimer(timerID,0.26,"frame4")
end

function frame4()
  speciale_action(2,4,true,0.25)
  speciale_action(2,7,true,0.25)
  n = n + 1
  if n >= 4 then
    StartTimer(timerID,0.26,"frame5")
  else
    StartTimer(timerID,0.26,"frame1")
  end
end

function frame5()
  speciale_action(2,1,true,1)
  StartTimer(timerID,1.1,"unBlock_Show_Cur")
end