Are you asking how to structure that in DnD, or what is the best way to identify the id of the object to be chopped?
THE FORMER:
If you go to the Control panel it has 'Set variable' and 'Test variable'
Looking at the GML you posted - it is structured the same in DnD.
create event of object:
Set variable
variable: range
value: whatever you choose
Mouse button event:
Test variable
variable: distance_to_object(object)
value: range
operation: less than
{execute code block}
Note: This is just me answering the question quite literally, and it wouldn't solve everything - as I will explain below.
THE LATTER:
distance_to_object will work, in that if you are at less distance than range it will meet the condition. However, it doesn't return an id of what the closest instance of that object is. instance_nearest as a function would return that identifying id, but it wouldn't necessarily be the tree you are clicking on.
Say, for example, two trees are very close together and you are clicking on the furthest of the two - it will act on the closest, because that is what the function returns.
You would want to look at the collision functions, and order it this way:
1) Mouse button check - does mouse_x / mouse_y register a collision with an instance of the tree?
Set variable
variable: inst
value : instance_meeting(mouse_x, mouse_y, obj_tree); // is the specific point mouse_x / y found to be in collision with the mask of obj_tree? If yes - it returns the id of that instance. If no - returns a value of 'noone'
2) Is there an instance there?
Test variable
variable: inst
value: noone
operation: equal to
tick as NOT // this reverses the condition: if 'inst' is not equal to 'noone' then we know it is instead an instance id
3) do a code block for this if it's true - 'inst' is not equal to 'noone', and so there is an instance at the mouse coordinates
Test variable
variable: point_distance(x, y, inst.x, inst.y) // get the distance between self (x / y) and inst x / y
value: range
operation: less than
{can chop}
else
{can't chop}
I haven't quite set up my test project in the same way as you might, seeing as I just wanted to test this rather than use specific details. But the above code block takes into account whether there is an instance, and is it within a certain distance.