come faccio a mettere il delay dei 10s tra un bod e l'altro,dopo la pubblish 57..?
	;
							
						
					codice:
	
	setup:
set %filledbookchangestr Deeds , #spc , in , #spc , Book: , #spc , 0
gosub findbooks
gosub checkfilledbook
gosub checkunsortedbook
;gosub checkclothbook
;gosub filledbookselect
;wait 1
;gosub emptybookselect
;wait 5
;--------------------------------------------------
;Main Loop
;--------------------------------------------------
gosub openbank
set %bodgiventovendor #true
loop:
if %bodgiventovendor
{
 gosub getbod
 gosub clickok
;wait 1
 gosub checkunsortedbook
 gosub checkclothbook
}
else
{
    gosub movenewbod
    wait 5
    gosub checkfilledbook
    gosub turnina 20
}
;wait 1
gosub turninb
set %bodgiventovendor #result
if #weight > #maxweight - 20
{
   gosub cutfat
   gosub tossit
}
sleep 10
goto loop
sub checkfilledbook
    event property %bodbag
    if %filledbookchangestr in #property
    {
       set %filledi %filledi + 1
       if %filledi <= %filledq
       {
          set %bodbag %filled . %filledi
       }
       else
           {
              gosub tossit
              gosub cutfat
              gosub movenewbod
              while 1 = 1
              {
                    sound
              }
           }
    }
return
sub checkunsortedbook
    event property %bodbook
    if 500 in #PROPERTY
    {
       set %unsortedi %unsortedi + 1
       if %unsortedi > %unsortedq
       {
          pause
       }
       set %bodbook %unsorted . %unsortedi
    }
return
sub checkclothbook
    event property %cloth
    if 500 in #PROPERTY
    {
       set %clothi %clothi + 1
       if %clothi > %clothq
       {
          pause
       }
       set %cloth %cloth . %clothi
    }
return
sub findbooks
    set %filledi 0
    set %unsortedi 0
    set %filledq 0
    set %unsortedq 0
    set %clothq 0
    set %clothq 0
    finditem DYM
    for %i 1 #findcnt
    {
        set #findindex %i
        event property #findid
        if filled in #property
        {
           set %filledi %filledi + 1
           set %filled . %filledi #findid
        }
        if unsorted in #property
        {
           set %unsortedi %unsortedi + 1
           set %unsorted . %unsortedi #findid
        }
        if cloth in #property
        {
           set %clothi %clothi + 1
           set %cloth . %clothi #findid
        }
    }
set %filledq %filledi
set %filledi 1
set %unsortedq %unsortedi
set %unsortedi 1
set %clothq %clothi
set %clothi 1
if %unsortedq = 0 || %filledq = 0 || %clothq = 0
{
   halt
}
set %bodbag %filled . %filledi
set %bodbook %unsorted . %unsortedi
set %cloth %cloth . %clothi
return
;-------------------------------------------------
;gets a new bod
;-------------------------------------------------
wait 11s
sub getbod
    getbod:
   exevent popup %trader %voption
   ;wait 2
   return
;-------------------------------------------------
; clicks yes in the bod menu
; Thx to Redsatin and Tecmo for this part.
;-------------------------------------------------
sub clickok
     set %timeout #scnt2 + 10
    bodgump:
    wait 5
    if #ContName = generic_gump && #CONTSIZE <> 615_454
    {
     ;wait 2
     set %size #ContSize
     str right %size 3
     ;wait 0
     set %clicky #strres + #ContPosY - 30
     set %ClickX 115 + #ContPosX
     wait 4
     click %clickx %clicky
     ;wait 2
     return
    }
    if %timeout > #scnt2
      {
      wait 1
      goto bodgump
      }
    wait 2
    return
;--------------------------------------------------
;transfers new empty bods to book
;--------------------------------------------------
Sub movenewbod
wait 11s
    finditem EYM c_ , #backpackid
    if #findkind <> -1
    {
      for %i 1 #findcnt
      {
          set #findindex %i
          repeat
              event property #findid
              str count #property $
              sleep 10
          until #strres > 1
          set %moved #false
          if small in #property
          {
             gosub bodfilled #property
             if ! #result
             {
                 if cloth in #property
                    gosub movetobook #findid %cloth
                 else
                    gosub movetobook #findid %bodbook
             }
          }
          else
              gosub movetobook #findid %bodbook
      }
    }
   if #contkind = IOIB
   {
   pause
     set %newx #contposx + 20
     set %newy #contposy + 20
     wait 5
     click %newx %newy r
     wait 5
     return
   }
 return
 sub bodfilled
 ;%1 #property
             str count %1 10
             set %cnt10 #strres
             str count %1 15
             set %cnt15 #strres
             str count %1 20
             set %cnt20 #strres
 if %cnt10 = 2 || %cnt15 = 2 || %cnt20 = 2
    return #true
 else
    return #false
 ;end bodfilled
 sub movetobook
 ;%1 bod
 ;%2 book
          exevent drag %1
          wait 2
          exevent dropc %2
          wait 6
 return
;--------------------------------------------------------------------------------------------
;drop bod out of book
;--------------------------------------------------------------------------------------------
sub turnina
;%1 numberofbods
  set #lobjectid %bodbag
  event macro 17
  for %i 1 %1
  {
      set %timeout #scnt2 + 20
      while #contName <> generic_gump && #contSize <> 615_454 && %timeout > #scnt2
        wait 1
      if #scnt2 > %timeout
         break
      set %dclickx #contposx + 40
      set %dclicky #contposy + 105
      wait 1
      click %dclickx %dclicky
  }
  set %timeout #scnt2 + 20
  while #contName <> generic_gump && #contSize <> 615_454 && %timeout > #scnt2
        wait 1
  set %newx #contposx + 20
  set %newy #contposy + 20
  wait 1
  click %newx %newy r
  return
;--------------------------------------------------------------------------------------------
;give the bod to vendor
;--------------------------------------------------------------------------------------------
sub turninb
finditem EYM c_ , #backpackid
if #findkind <> -1
{
   set %filledbodfound #false
   for %i 1 #findcnt
   {
       set #findindex %i
       repeat
             event property #findid
             str count #property $
             sleep 10
       until #strres > 1
       gosub bodfilled #property
       if #result
       {
          set %bod #findid
          set %filledbodfound #true
          goto turninb_bodfound
       }
   }
   turninb_bodfound:
   if %filledbodfound
   {
      finditem %trader
      while #finddist > 2
      {
            wait 1
            finditem %trader
      }
      gosub movetobook %bod %trader
      return #true
   }
   else
       return #false
}
else
  return #false
sub takerandom
    set %result #random / 200
    set %result %result - 2
    return %result
return
;--------------------------------------------------------------------------------------------
;drops unwanted stuff to the ground
;--------------------------------------------------------------------------------------------
sub tossit
    finditem %storage
    if #findkind <> -1
    {
            finditem %tossem c_ , #backpackid
            repeat
                  if #findkind <> -1
                  {
                     for %i 1 #findcnt
                     {
                      set #findindex %i
                      exevent drag #findid #findstack
                      gosub takerandom
                      set %gdropx #charposx + #result
                      gosub takerandom
                      set %gdropy #charposy + #result
                      wait 2
                      exevent dropg %gdropx %gdropy
                      wait 6
                     }
                  }
                  finditem %tossem c_ , #backpackid
            until #findkind = -1
    }
wait 10
return
;-------------------------------------------------
; drops stuff to storage
;-------------------------------------------------
sub cutfat
  finditem %storage
  if #findkind = -1
  {
     gosub openbank
  }
  ;event macro 1 0 #result
  if #result = ok || #findkind <> -1
  {
     finditem %keepers c_ , #backpackid
     repeat
           if #findkind <> -1
           {
              for %i 1 #findcnt
              {
               set #findindex %i
               exevent drag #findid #findstack
               wait 2
               exevent dropc %storage
               wait 6
              }
           }
           finditem %keepers c_ , #backpackid
     until #findkind = -1
     }
  }
return
sub openbank
    while #CHARPOSX <> 976 || #CHARPOSY <> 526 || #CHARPOSZ <> -50
    {
        event pathfind 976 526 -50
        wait 3
    }
    set %timeforbank #systime + 30000
    repeat
          exevent popup %banker1 2
          exevent popup %banker2 2
          finditem %storage
          sleep 10
    until #findkind = 0 || #systime > %timeforbank
    finditem %storage
    if #findcnt = 1
    {
       wait 60
       set #lobjectid %storage
       event macro 17 0
       return ok
    }
return



Commenta