This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
In GMS 2.2, the other keyword returned an instance ID. In that version of Game Maker, you could do this:
// This script will return a list of instance IDs of characters that are not the
// character who is calling the script.
instances_that_arent_me = ds_list_create();
with o_character {
if (id != other) {
ds_list_add(instances_that_arent_me, id);
}
}
return instances_that_arent_me;
However, in GMS 2.3, other is not an instance ID. It is a struct that has an instance ID inside it. So you would have to update the above script like so:
// To achieve the same result in GMS 2.3, you have to reach inside the "other"
// struct and use dot notation to get the instance ID out of it.
instances_that_arent_me = ds_list_create();
with o_character {
if (id != **other.id**) {
ds_list_add(instances_that_arent_me, id);
}
}
return instances_that_arent_me;
You can still use other like this in both versions, however:
with other {
do_some_stuff();
}
This means that you will need to evaluate your code, because wherever you were using the keyword other in GMS 2.2, you may need to replace that with other.id in GMS 2.3.
-----
Source (Butterscotch Shenanigans): https://www.notion.so/other-keyword-4a09191a4e7e472592867a2a536e0f7a
Subreddit
Post Details
- Posted
- 4 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/gamemaker/c...