I used show_debug_message to see whats inside of id, and it actually returns the id of the 2 instances, 100000 and 100003, but how can the id variable hold 2 values at same time? It seems like its cycling through the instances of the same object, getting the id of each one. Is this how id variable works?
How are you getting the id's? AFAIK instance ID's are assigned on creation. They don't change during the game.
As for your original question there's a few ways you can do it, depending on how you created the instances.
If you added them in the room yourself, you can just go into the creation code (from double clicking on the instance inside the room) and in your desired instance, do something like this:
Code:
global.chosenCharacter = id;
If you're creating them by another object, you'd do it like this:
Code:
global.chosenCharacter = instance_create_depth(....); //insert correct variables in place of the "....."'s
Plenty of built-in functions
return the instance id, which is why the above code works. To see what functions will
return id's, check the functions in the manual (and scroll down a bit, usually).
Whatever way you decide to use, you can then use
global.chosenCharacter to do things like:
Code:
global.chosenCharacter.x -= 20; //moves the instance 20 pixels to the left
//or
with global.chosenCharacter{
x -= 20;
}