It's unecessary to try and work out how to store a "reference" to an object in events. The usual way is just to use the object-picking conditions to run the logic. For example, given the situation:
- each 'unit' has the private variables is_selected, can_build
- 'build' button should be invisible unless a selected object (is_selected = 1) can build (can_build = 1)
Then you can just take advantage of the top-to-bottom execution of events:
+ Always
-> Build button: Make invisible
+ Unit: 'is_selected' equals 1 (...picks all selected units)
+ Unit: 'can_build' equals 1 (...picks all selected units that can build)
-> Build button: Make visible (...this only runs if at least one object met the above conditions)