The "instance_find_var" Function
#
SyntaxArgument | Type | Description |
---|---|---|
var | string | The variable name to search for, as a string |
n | integer | The ordinal instance number to return, if multiple results are found |
#
DescriptionSearches existing instances for a particular variable and returns the ID of the containing instance, or keyword noone
if not found.
If multiple matching instances exist, you can specify which number to return with the n
argument, where the first instance is 0
. If the input number is greater than the number of matching instances, the last result will be returned.
important
GameMaker instance order can vary based on many factors, so when multiple instances exist, this script may not always return the same ID each time!