Artifact [149564909d]

Artifact 149564909d18919a5504f597a351c2516b8d6f52:


sub INIT
  initEvents
  ignoreItem reset
  set %__EMPTY__
return

sub WAIT_TARGET
  set #targcurs 1
  targetloop:
  If #targcurs = 1
  goto targetloop
return

sub CONFIGURE
  event SysMessage Please move your character to the desired home location and target an animal for taming.
  gosub WAIT_TARGET
  findItem #LTARGETID
  set %TAME_TYPE #FINDTYPE
  set %TAME_ID
  set %HOME_X #CHARPOSX
  set %HOME_Y #CHARPOSY
  set %DEFAULT_FOLLOWERS #FOLLOWERS
  set %LAST_ATTEMPT 0
return

sub MOVE_CHAR
  move %1 %2 0 2s
  if  #CHARPOSX <> %1 || #CHARPOSY <> %2
  {
    event PathFind %1 %2
    sleep 2s
  }
return

sub SEARCH_TAME
  findItem %TAME_TYPE
  if #FINDKIND = -1
  {
    set %TAME_ID
    return
  }
  event Property #FINDID
  if Paragon in #PROPERTY
  {
    ignoreItem #FINDID
    set %TAME_ID
    return
  }
  set %TAME_ID #FINDID
return

sub ATTEMPT_TAME
  if %LAST_ATTEMPT + 3500 < #SYSTIME
  {
    event Macro 13 35
    target 2s
    set #LTARGETID %TAME_ID
    event Macro 22 0
    set %LAST_ATTEMPT #SYSTIME
  }
return

sub AUTOMATE
  gosub SEARCH_TAME
  while %TAME_ID = %__EMPTY__
  {
    gosub MOVE_CHAR %HOME_X %HOME_Y
    gosub SEARCH_TAME
  }
  while #FINDKIND <> -1
  {
    gosub MOVE_CHAR #FINDX #FINDY
    gosub ATTEMPT_TAME
    if #FOLLOWERS > %DEFAULT_FOLLOWERS
    {
      ignoreItem %TAME_ID
      gosub SEARCH_TAME
    }
    findItem %TAME_ID
  }
return

gosub INIT
gosub CONFIGURE
while #true
{
  gosub AUTOMATE
}

halt