It's using distance between points, but then I would need the attack range value so the operation would become functional. I think that there's not really a effective and easy way of getting the attack range other than using hashtables or some woraround (like the point value in object editor, mentioned above). There was a thread on the lab that said it could be possible to read data from the object editor (here:
Accessing memory from the script - it's time of the revolution ) but it would be even more difficult than building a hashtable.