This may work dont know how to use it up get it to work if you can help with that
Sub Main /call DefineGlobals :Loop /Call TargetItem /Call MoveToItem /Call GetItem /Call Rest /goto :loop /return Sub DefineGlobals /declare TargetDistance global /return Sub TargetItem /echo Targeting a shroom ...