Hello -h,
You are dead right!!! Thanks for curing my headache. Apparently the "private []" isn't necessary either. No telling where I picked that up from.
Thanks to everyone that helped out here.
And for anyone else that may come along, here's the whole script. (distance.sqf)
// Return the distance between 2 units;
// Called with nul = [player, group] execVM "Distance.sqf";
_Aunit = _this select 0;
_Bunit = leader (_this select 1);
// get the x and y coord of the units;
_pos = GetPos _Aunit;
_xA = _pos select 0;
_yA = _pos select 1;
//Titletext [Format ["Aunit's x coord is %1 and y coord is %2", _xA, _yA], "Plain"];
_pos = GetPos _Bunit;
_xB = _pos select 0;
_yB = _pos select 1;
// dist equals sq root of diff x axis' squared plus diff y axis' squared;
_dist = sqrt ((_xA - _xB)^2 + (_yA - _yB)^2);
// display the distance;
Titletext [Format ["Distance from %1 to %2 is: %3", _Aunit, _Bunit, _dist], "Plain"];