Ah, it's not very hard. It's different than normal item scanning. I'll explain some from my Beetle Lumberjacker.
The best way to hunt for trees is to use the tile stacks. First you need in your code somewhere in your setup section:
tile init
Then you need a determine how many different tiles are located at a specific location:
; !targx, !targy computed somewhere relative to your character...
tile cnt !targx !targy #CURSKIND
if #TILECNT > 0
{
for !i 1 #TILECNT
{
tile get !targx !targy !i #CURSKIND
if tree in #TILENAME
{
; you found a tree, wack it.
}
}
}
But how do you wack it? Well you need to save the stack information found to the last target tiles stuff by:
set #LTARGETX !targx
set #LTARGETY !targy
set #LTARGETZ #TILEZ
set #LTARGETTILE #TILETYPE
set #LTARGETKIND 3
Now you can use "event macro 22" on the tile space to hack at.