Just has one argument.  
%1 = Radius to search
returns #TRUE if a tree is found, otherwise #FALSE
Sub sets up the #LTARGET information so you can just event macro 22 (use last target)
sub TM_LocateTree
  namespace push
  namespace local LT
  if !init = N/A
  {
    tile init
    set !init #TRUE
  }
  set !radius %1
  set !xmin #CHARPOSX - !radius
  set !xmax #CHARPOSX + !radius
  set !ymin #CHARPOSY - !radius
  set !ymax #CHARPOSY + !radius
  for !x !xmin !xmax
  {
    for !y !ymin !ymax
    {
      tile cnt !x !y #CURSKIND
      if #TILECNT > 0
      {
        for !i 1 #TILECNT
        {
          tile get !x !y !i #CURSKIND
          if tree in #TILENAME
          {
            set #LTARGETX !x
            set #LTARGETY !y
            set #LTARGETZ #TILEZ
            set #LTARGETTILE #TILETYPE
            set #LTARGETKIND 3
            namespace pop
            return #TRUE
          }
        }
      }
    }
  }
  namespace pop
return #FALSE
 
If anything, hopefully this will de-mystify the TILE stuff.