GameMaker: Studio

GameMaker: Studio

View Stats:
Swaggless Jun 16, 2015 @ 5:23pm
Call user event in a specific instance?
Hey, so I'm creating a game in Game Maker: Studio (I own a non-steam version) and I'm looking to create a button object. When it is pressed, it calls a user defined event within another instance of another object. This instace is stored in a variable, so the instance ID can be defined in the instance's creation code (making the button's applications more flexible come level-design time).

The trouble I am running into is that I cannot find out how to call an event for a specifc instance from my button object... I've tried a few different approaches and searched both the manual and web with no luck.

Any ideas?
< >
Showing 1-5 of 5 comments
Blind Jun 16, 2015 @ 5:27pm 
with(instanceID) {
event_user(number)
}
Swaggless Jun 16, 2015 @ 6:29pm 
Originally posted by BBX:
with(instanceID) {
event_user(number)
}
Ahhh! Lemme give that a shot.

EDIT: Worked like a charm! Thanks so much! I didn't know "with" worked with instances.
Last edited by Swaggless; Jun 16, 2015 @ 6:31pm
Blind Jun 16, 2015 @ 6:47pm 
with stands for both with and within, and can be used in both contexts... similar to how scripts can be procedures or functions.
Swaggless Jun 16, 2015 @ 10:01pm 
Originally posted by BBX:
with stands for both with and within, and can be used in both contexts... similar to how scripts can be procedures or functions.
Excellent! Thanks again for the help. It'll prove very useful.
Last edited by Swaggless; Jun 16, 2015 @ 10:02pm
Hex: Pound Town Jun 7, 2019 @ 3:23pm 
Thank goodness this thread exists. I'd been using event_user_object and this works in the way I expected it to.
< >
Showing 1-5 of 5 comments
Per page: 1530 50