This is a bit of a hack and takes advantage of the system-parser interpreting any line starting with ! as a call to an installed API script, and if it can't find a script that makes it happy it silently discards the line.
Here's a simple proof of concept macro you can immediately try for yourself:
/me bops ?{Number of targets?|1} target(s) on the nose!
Target 1: @{target|Target1|token_name}
?{target2|!} Target 2: @{target|Target2|token_name}
?{target3|!} Target 3: @{target|Target3|token_name}
This macro will ask you to select three targets, as that is the maximum number of targets this macro handles. It will then ask you how many targets, for the benefit of the emote. And then it will bring up prompts for target2 and target3: If you wish to bop them on the nose, remove the ! and leave the box blank. If you do not wish to bop them on the nose, leave the ! in the box. And you must be asking, "But what if I want to only bop 1 person? Who do I click for targets 2 and 3?" and my answer is, "Click on your own token to pad out the list."
Try it out a few times and you'll quickly get the hang of it.
This is an real life example from my husband's character in a Pathfinder game:
@{selected|token_name}'s dragon pistol sprays a 15' cone of pellets which engulfs ?{Number of targets?|1} target(s), potentially dealing [[d6 + @{Silva|Dragon|max} + ?{MiscBonusDamage|1} ]] damage each, [[3d6 + (3* @{Silva|Dragon|max} + ?{MiscBonusDamage}) ]] additional on a crit. (P/B damage, Misfires if ALL ATTACK DICE roll a 1 to ?{MaxMisfire|3}).
@{target|target1|token_name}: AC [[1d20r20 + @{Silva|Dragon} -2 + ?{MiscToHitBonus?|1} ]]
?{target2|!} @{target|target2|token_name}: AC [[1d20r20 + @{Silva|Dragon} -2 + ?{MiscToHitBonus?} ]]
?{target3|!} @{target|target3|token_name}: AC [[1d20r20 + @{Silva|Dragon} -2 + ?{MiscToHitBonus?} ]]
?{target4|!} @{target|target4|token_name}: AC [[1d20r20 + @{Silva|Dragon} -2 + ?{MiscToHitBonus?} ]]
?{target5|!} @{target|target5|token_name}: AC [[1d20r20 + @{Silva|Dragon} -2 + ?{MiscToHitBonus?} ]]
?{target6|!} @{target|target6|token_name}: AC [[1d20r20 + @{Silva|Dragon} -2 + ?{MiscToHitBonus?} ]]
?{target7|!} @{target|target7|token_name}: AC [[1d20r20 + @{Silva|Dragon} -2 + ?{MiscToHitBonus?} ]]
There is a lot going on in this macro; I have bolded the bits that are important for this discussion.
This is an attack that does an AOE that can potentially target up to 7 creatures.
When the macro goes off, first Silva is asked to click on 7 targets. If he is attacking less than 7 targets, he clicks on his own token to pad out the targeting list. Then the roll-queries start. Among the other roll-queries it asks for how many attacks he's doing. This is for the GM's benefit and helps focus his attention on the actual targets. There's other roll-queries going on, setting up other bits of information needed for the attack. And then it will prompt for target2 through target7, each time showing ! as the default option. For each attack Silva wishes to make, he deletes the ! and leaves the box blank. For each attack-target Silva does not want to hit, he leaves the ! in place. We list the number of targets for the GM's benefit.
---
As I said, not simple, not efficient, not compact. I hope these two examples help you out. :)