; Separa2: Separamos los montones de ore que queremos separar 
; de los que no
;   %1 Color del mineral a mover
;   %2 Bueno / Malo
set %TiempoLimite #SCNT + 10   

set #findmod 0_0
set %SepDestx 773
set %SepDesty 403

if %2 = Bueno
  {
   set %SepDestx 681
   set %SepDesty 442
  }

SepStart:
; Sin buscar ores de tamao 1, aceleramos la busqueda
                        call keepalive
finditem %t_bigores
;wait 1
if %TiempoLimite < #SCNT
    exit
if #findkind < 0
   exit

if #findkind > 0 
 {
  ignoreitem #FINDID
  goto SepStart
 }

 if #findy < 365
 {
  ignoreitem #FINDID
  goto SepStart
 }

if %1 <> #findcol
  {
  ignoreitem #FINDID
  goto SepStart
  }

 if #findy >= 477
   {
    if %2 = Malo
      exit
   }

 if #findx > 707
  {
   if %2 = Malo
     exit
  }


set #findmod 27_17
; Esto aun no funciona, hay que arreglarlo
 if #findy > 518
  {
   if #findx > 735  
     goto noenmenos 
   if #findx < 713
     goto noenmenos 
; Estan en el simbolo menos de la mochila, lo cual es un problema,
;lo debemos mover. Usando event grab o el grab de injection es mas facil

     set #findmod 41_6
     if #findy > 527
         set #findmod 28_39

     if #FINDSTACK = 3
       {
;Este es jodio
;Mal rollo aqui
        if #findx < 730
           set #findmod 28_39
        if #findx >= 730
           set #findmod 36_12
       }
        wait 3
        drag #findx #findy 740 417 ALL
        wait 5
        call recbolsa
        set #findmod 0_0
        goto sepstart
    }
  }
noenmenos:


set #findmod 27_17
if #findx = 681
 {
  if #findy = 442
    {
      if %2 = Bueno
        {
          Set %faltanxsep #findstack - 1
          goto SepEnd
        }
    }
 }

                   call keepalive
 call recbolsa2
 call drag #findx #findy %SepDestx %SepDesty ALL
 Set %faltanxsep #findstack - 1
 call recbolsa2
; ignoreitem #FINDID

SepEnd:
