That is how I was doing it, and I don't get any error messages. I decided to add one line--the hint line--to see just what the result of the calculation is, changing the code to:
_tank = _this select 0
_group = _this select 1
#Here
?(_tank distance (leader _group) > 100):_tank setFuel 0
hint format["Distance = %1", _tank distance (leader _group)]
~10
_tank setFuel 1
goTo "Here"
If I pass "L1" to the script, I get a number showing the distance. However, if I pass "Infantry1" to the script, the hint says, "Distance = scalar". Below, first is the init field of the man, L1, and second is the init of the tank.
Infantry1 = group this
[Tank1, Infantry1] exec "KeepInFront.sqs"
So to sum up, it works if I use "L1" and not "Infantry1" in the second init field.
I think there is something about the result returned from "Infantry1 = group this" that I don't understand.