Possible to reference a specific object?

Questions about GP commands and how to do things

Moderator: MSandro

Post Reply
SvenJ
Posts: 25
Joined: Jul 6th, '17, 08:03

Possible to reference a specific object?

Post by SvenJ » Jul 14th, '17, 10:31

Hey everyone, more questions here :)

I asked this in another thread, but probably better to talk about it in a separate thread: Is it still possible to reference a specific object on the stage? It used to be possible via the extended (shift+right-click) menu, but I don't see the option anymore.
Was this removed entirely, or just moved elsewhere?

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Possible to reference a specific object?

Post by JohnM » Jul 14th, '17, 12:20

I'm not quite sure what you mean by "reference".

You can make select a given instance as the target of the scripter by clicking it's thumbnail under the stage. Doing that will allow you to see the values of it's instance variables in the "Variables" category and control it directly with blocks in the palette and scripting area. Another way to select an instance is to alt-click (option-click on Mac) on it.

If what you want to do is make a variable refer to to an object, there's a non-obvious but very useful shortcut. You can drag and drop the object from the stage onto the readout for a particular variable in the "Variables" category of the palette. The object will fly back to where it was on the stage and the variable will have a reference to that object. After you've done that, an "eyeball" icon appears next to that variable. Holding down the mouse on that icon will show and arrow pointing to the object on the stage.

Hope that helps!

SvenJ
Posts: 25
Joined: Jul 6th, '17, 08:03

Re: Possible to reference a specific object?

Post by SvenJ » Jul 14th, '17, 12:26

JohnM wrote:
Jul 14th, '17, 12:20
I'm not quite sure what you mean by "reference".

You can make select a given instance as the target of the scripter by clicking it's thumbnail under the stage. Doing that will allow you to see the values of it's instance variables in the "Variables" category and control it directly with blocks in the palette and scripting area. Another way to select an instance is to alt-click (option-click on Mac) on it.

If what you want to do is make a variable refer to to an object, there's a non-obvious but very useful shortcut. You can drag and drop the object from the stage onto the readout for a particular variable in the "Variables" category of the palette. The object will fly back to where it was on the stage and the variable will have a reference to that object. After you've done that, an "eyeball" icon appears next to that variable. Holding down the mouse on that icon will show and arrow pointing to the object on the stage.

Hope that helps!
Yes, it does indeed, thank you!

I was looking for something similar to the block shown in the attached screenshot (taken from an older version of GP). This "id"-block could be used to broadcast messages directly to only one specific object (identified by that green reporter block, see the other screenshot). It looks like the method you described is a very nice workaround to get the same behavior, though :)

edit: These are old screenshots, so they don't refer to the same object, and they aren't even from the same project, but they're the only ones I could find :) Sorry for the confusion.
Attachments
extbroadc.png
extbroadc.png (5.13 KiB) Viewed 10857 times
id.png

Post Reply