Is it possible to create object within extension?

So I wanted to make extension with the function where user can check if button is really clicked or tapped and return true or false. I do have idea how to make that but I ran into an issue where I can’t see a solution in creating object inside my extension. (The page where u are editing extension’s behavior and functions)

Events: https://prnt.sc/KmPcTL_-6KPP

What I mean by “really clicked”?
I mean that when you click right mouse button on some object, and release it on the same object, it will be registered as real click. Any other case (for example u click and hold mouse button somewhere else, then drag cursor on the object and release it) is considered as not real quick.

I haven’t done anything like this , but your code seems correct.
What’s the problem? What currently happens?
Does the game not quit if you press the menu_exit button?

No, I wan’t to make this group of events as a function in my extension. So whenever I select some object and call that function which will be named for example “Is object clicked” it will execute all those events on that object and return true or false.

I don’t really know how better to explain this but in some programming languages this would be called stock, class, private function, etc. Basically piece of code with parameters to be used in other functions.



So I tried this way, but it only works if there is 1 object on the event sheet, if there is more (like in this example) it doesn’t work at all. None of the objects gets tinted. What am I missing?

Did you try this extension?
https://wiki.gdevelop.io/gdevelop5/extensions/panel-sprite-button/reference

That one doesn’t work quite well because if you click and hold left mouse button on the blank area, then drag cursor on the button (tree for example in this case) and release mouse button it will be detected as it’s clicked normally.

Good catch! I’ll make a fix.

The new extension version (1.1.2) fixes the issue.

That was fast! Tested and works perfectly, thank you!