Object reference for any clone/original object

A feature I’d like to see in Hopscotch is:

An object reference that means “original object or any clone” without having to specify a specific object. Similar to how “Original Object” or “Self” doesn’t need a specific object reference.

I’d use it for this type of project:

Reuse of code in custom rules

Here are some examples of Hopscotch code that could be improved if we had this:

The selection shown means “original object or any clone” but only for that object. There is no unspecific reference with the same meaning, which means there’s no way to reuse this code in a custom rule for multiple objects.

I’ve seen something similar in another programming languages, it looks like this:

In Hopscotch & it looks like this (Original Object) and (Self).

See posts 5-7 for addition clarification.


Like “Get rid of direct object references” (like the one on the official Hopscotch Roadmap) or are you referring to something else?


Yeah I have really wanted something like this too. I think local variables would be a prerequisite for this e.g. If you have a When [object] is tapped rule, the [object] variable would be local to that rule only


This is an interesting idea.
This would be cool.


@Crosbyman64 No, this would still be a direct reference. Just a non-specific direct reference, that depends on the context/object where it’s used. Just like ‘Original Object’

@t1_hopscotch Not for variables. Just an object reference. So I don’t think it’d be blocked.

Let me try again.

Replacing the reference shown in the example shown in the OP, When (‘any clone’, or whatever you want to call it) is Tapped would cause all of the clones and the original object of the tapped object to run code.

If the rule isn’t used in a custom rule, it would have the exact same behavior as shown. But this new reference would allow the rule to be used within a custom rule and have that behavior apply to any object (set of clones) that it gets added to.

You can do this

Or this

and the code will work for any object you add it to, right?

But there’s no generic reference that means the same as this one:

With that code, when any of the squares are tapped, all squares will change color.

But since there’s no unspecified/generic equivalent that means “original object & all clones”, there is currently no way to use that custom rule with other objects and have it work the same


to confirm, this would basically be “when any instance of this object is tapped, have all the clones of this object do the following”?


Yes. All the clones & the original object (since “clones” is subject to interpretation as to whether or not original object is included)

I like your wording of “any instance of this object”.


alright—I agree that this would be useful


Would a @Leader please edit a comment into the bottom of the OP that says

“See posts 5-7 for addition clarification.”


Tagging @Awesome_E (refer to above post)


@t1_hopscotch Sorry, I just got your point! Yes, it would also be applicable to Object Variables, just like Original Object & Self.

I still don’t feel like Local Variables is necessarily a prerequisite though, since the reference could work the same as Original Object & Self do today?


Oh I understand what you mean now — so it is the object reference and not a variable. We can disregard what I said about local variables then^^


OP has been modified with changes. ✓ (I’m guessing by t1_hopscotch, thanks btw).


When self clone under index 5 Is tapped


So like

When (self) is tapped {
   Check once if ((self)clone index) < (5) { //targets only objects with an index of 4 or lower
      // Do code

But more code efficient.