 ; FUNCION DRAG %1 %2 %3 %4 %5
 ; Descripcion: Arrastra un objeto de un origen a un destino
 ; %1 %2 : X e Y origen
 ; %3 %4 : X e Y destino
 ; %5    : Cantidad a mover
 ;         Caso especial: Si %5 = Simple, moveremos un objeto simple
                          Si %5 = All = $
  set %MaxDragTime #SCNT + 5

   set %dragout 0
 if %5 = ALL
   set %5 $
begindrag:
   click %1 %2 g
     if %5 = Simple
       {
         wait 4
         goto enddrag
       }
     dragwait: 

;Un timeout
  if %MaxDragTime <= #SCNT
      exit 

  if %mochilapr = #Contid
     {
;A ver si lo que hemos pillao es el backpack!
      set %cagada False
      if #contposx <> 610
         set %cagada True
      if #contposy <> 360
         set %cagada True
      If %Cagada = True
        { 
         if %mochilapr = #Contid
          {
           click %1 %2 p
           wait 15
           contpos 610 360
           wait 10
           goto begindrag
          }
        }
     }


       set %dragout %dragout + 1
       if %dragout > 10
           {
              scanjournal 1
                if %msg_saveworld in #journal 
                   {
                     msg $/ %Finish_Read $
                     wait 24s
                   }
              call keepalive
             if %dragout > 30
                {
                  call recbolsa
                  goto enddrag 
;kizas?
 ;                 click %1 %2 p
  ;                exit
                }
           }
       wait 1
       if  GHRD <> #ContKind
         goto dragwait
    msg %5 $
;probando sin esto    wait 2
enddrag:
    click %3 %4 p
    if %dragout > 30
        call recbolsa

