Cool! This taught me that "other" can refer to the executing instance even while inside a with-construction, making it a great starting point for many different scripts I've been missing. Thanks!
By the way, you shouldn't call "point_distance(x, y, other.x, other.y)" twice - instead store it in a temporary variable.
Okay, "other" does not refer to the instance running the script; not in my version of GM anyway. One can, however, use global variables for this.
I saw too late.
Local variables can be shared in with-statement by using prefix 'other.' In contrast,
temporal variables that defined wih 'var' can be shared in current script without any prefix.
If variables are not defined as 'temporary' can be brought up from an arbitrary instance that exists,
otherwise( that is, if the variable is not temporary) it can not be used within other instances by the usage of With statement.
var id_s, distance, distance2;
distance2=point_distance(x, y, other.x, other.y)
if distance>distance2 and id!=other.id /*and ...*/
Edited by wnsrn3436, 02 August 2012 - 11:37 AM.