local Index1=-1;
local Index2=-1;
local Index3=-1;
function mini_create ()
  show_help_wnd=true;
  init_mini(1);
  -- create_mini(8128);
  create_mini(33,8,8,-1,-1,1,4,-1,0,1,0,2,4,5,-1,0,1,1,3,4,5,6,-1,0,1,2,5,6,7,-1,1,0,0,1,2,5,-1,1,0,4,1,2,3,6,-1,1,0,5,2,3,7,-1,-1,-1,6,3,-1,184,55,342,258,348,55,504,258,507,55,666,258,669,55,826,258,184,262,342,484,344,262,506,484,507,262,665,484,665,262,826,484,4,4,-1);
flags.minicomplete42=false;
  --[[
  create_mini
    (
      33,8,8,
      -1,-1,1,4,-1,
      0,1,0,2,4,5,-1,
      0,1,1,3,4,5,6,-1,
      0,1,2,5,6,7,-1,
      1,0,0,1,2,5,-1,
      1,0,4,1,2,3,6,-1,
      1,0,5,2,3,7,-1,
      -1,-1,6,3,-1,
      184,55,342,258,
      348,55,504,258,
      507,55,666,258,
      669,55,826,258,
      184,262,342,484,
      348,262,504,484,
      507,262,665,484,
      665,262,826,484,
      2,2
    );
--]]
end;
--function mini_msg_proc (id)
function gameinput (sender,id,attachedID)

  if sender==30 then
  BlockCursor(false);
    setcurentleaf("flower",14,0);
      flags.nohints=false;
    if flags.minicomplete42 then
      playeffect("29");
      StopEmiter("Svet2");
      speciale_action(2,57);
      CreateWindow(150,250,"207",14,nil,250,20);
      --playeffect("01");  
      Set_Cursor(33,3);
      Set_Cursor(57,2);
      savegame(SaveLevel());
    return; end;
  return; end;  
  if sender==10 then
    flags.minicomplete42=true;


    StartTimer(2100,1)  
    BlockCursor(true);
  return; end;
  if sender==37 then
     skipping=true;
  return;end;  
  if sender==35 then
    if (not flags.minicomplete42) then

      iIndex1,iIndex2,iIndex3=gtrGetEmptyNeighbours(2);
      InfoFromGraphTravel(iIndex2,iIndex3);
    return; end;     
  return; end;
  if sender==39 then
    if (not flags.minicomplete42) then

      InfoFromGraphTravel(-1);
    return; end;  
  return; end;
  if sender==36 and id==2100 then
clear_satelite_leaf("flower");
  return;end;  
  if sender==100 then
    if not help then
      CreateWindow(200,200,"2",100,"messageinfo",30,50)
      --playeffect("01");  
      help=true;
    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==26 then
    if id==100 then
    set_visible_object(5001,true)
    end;
  return; end;
  if sender==1 then
    if id==6000 then

       helpbtn=true;
    return;end
    if id==5000 and skipping then
      if not flags.minicomplete42 then
        finish_mini_game(true);
      return;end;  
    return;end;
    if id==645 then
      playeffect("17");  
      finish_mini_game(false);
      clear_satelite_leaf("flower");
      DeleteResource("m42_close"       );
      DeleteResource("m42_fon"         );
      DeleteResource("m42_lenta2"         );
      DeleteResource("m42_lenta"         );
      DeleteResource("svyazi"         );
      DeleteResource("podsv"         );
      DeleteResource("s4et"         );
      DeleteResource("m52_lenta"         );
    return;end;
      if id>=646 and id<=651  then
      fGame=true;
      add_to_mouse(id);
--      mousepresed=true;
      objectid=id;
      
      x1,y1=GetObjectPosition(objectid)
    -- fcounter=fcounter+1;
    -- obj[id]=true;
    -- set_pos_in_img(660,(fcounter+1)*30,0,30,34);
    -- playeffect("chik");
    -- if fcounter>7 then 
      -- GraphTravelReset(nCount)
    -- return;end;
  


    return; end  
    return;end;
    
if sender==6 then

  if not flags.minicomplete42 then
    if helpbtn then
       CreateWindow(200,200,"2",100,"messageinfo",30,50)
         playeffect("11");  
      helpbtn=false;
    end;
  if fGame==true then


      playeffect("gorwok");
    -- playeffect(9);
        RemoveFromMouse(objectid);
      -- if  then
        check_mini_game_GraphTravel(objectid);
      if not flags.minicomplete42 then
      x2,y2=GetObjectPosition(objectid)
      fGame=false;
        objectid=0;
    if x2~=x1 or y2~=y1 then
      fcounter=fcounter-1;
      set_pos_in_img(660,(fcounter)*30,0,30,34);
      playeffect("chik");
      if fcounter<0 then 
         check_mini_game_GraphTravel(-1);
        fcounter=7;
      return;end;
      return; end  
    return;end;
    return;end;  
    return;end;  
  return; end;
end;
function GraphTravelReset(nCount)
 
  SetObjectPosition(646,353,68);
  SetObjectPosition(647,514,68);
  SetObjectPosition(648,671,68);
  SetObjectPosition(649,508,285);
  SetObjectPosition(650,346,285);
  SetObjectPosition(651,186,285);
  set_pos_in_img(660,180,0,30,34);
end;
function InfoFromGraphTravel(Param2,Param3)

  if Param2~=-1 and Param2~=nil then
   -- messagebox("1")
    SetObjectPosition(644,FieldsX[Param2+1],FieldsY[Param2+1])
    -- SetObjectPosition(643,FieldsX[Param3+1],FieldsY[Param3+1])
    if not flags.podsv then
    speciale_action(2,644)
    -- speciale_action(2,643)
    flags.podsv =true;
      end;
    lastplawka=Param2;
  end;  
  if Param3~=-1 and Param3~=nil  then
   -- messagebox("1")
    -- SetObjectPosition(644,FieldsX[Param2+1],FieldsY[Param2+1])
    SetObjectPosition(643,FieldsX[Param3+1],FieldsY[Param3+1])
    if not flags.podsv2 then
    -- speciale_action(2,644)
    speciale_action(2,643)
    flags.podsv2 =true;
    end;
    lastplawka1=Param3;
  end;
  if Param2==-1 then
     -- messagebox("2")
     if flags.podsv then
    speciale_action(2,644)
    -- speciale_action(2,643)
    flags.podsv= false;
     end;
    lastplawka=-1;
  end;
  if Param3==-1 then
     -- messagebox("2")
     if flags.podsv2 then  
    -- SetObjectPosition(643,-500,141+32)
    speciale_action(2,643)
    flags.podsv2= false;
     end;
    lastplawka1=-1;
  end;
end;