JASS:
function DistanceBetweenPoints takes location locA,location locB returns real
That is NOT the most effictave way.
JASS:
SquareRoot((xto - yfrom)*(xto - yfrom)+(yto - xfrom)*(yto - xfrom))
xto = X location of position your measuring from
yto = Y location of position your measuring from
xfrom = X location of position your measuring to
yfrom = Y location of position your measuring to
Using this will save you having to remove the location and creating a local location since it takes reals (x and y).
I recomend you use jass since propper jass can be less laggy than GUI since GUI calls unesesary BJ calls and creats functions for conditions that are NOT nesesary.
Also non jass aided GUI will leak when using groups, locations, and forces.
I strongly reccomend you program MOST triggers in jass since you can reduce not only the number of lines the script takes up but write it more efectivly.
A good example of GUI triggering is the parasite chain.
It leaks badly, is very buggy, extremely laggy, and a ---- load of unessary function and BJ calls.
I write every trigger in my maps in jass.