Greetings!
Off the top of my head, all I can think of is that the onMapSingleClick (v1.85+(?)) command passes the number of units (or possibly which units) to the script.
Take a look at the comref entry for it, and feel free to correct me.
Sorry I couldn't be more help at the moment
-Supr. Cmdr. PsyWarrior
-Psychic Productions