[Solved] How can I tell if a function condition will trigger or not?

I’ve been trying to make small functions of reproduceable code for things in the game that I’m using a lot.

One of those things is a basic confirm function.

Here is the function I’ve made for confirm, it uses the gamepad extension:

And my events sheet showing the function


This doesn’t work, but if i replace the function with the events, it works as intended

You forgot an action in your function. You have to have the “return true” action, at minimum.

1 Like

Functions, unlike external events, are not copy pasted in place of the place they are used in, they are internally real functions. That means that you have to give a return value for the engine to process. You can do that with the events in the “Functions” category.

2 Likes

Thank you both. I learned something new today. :slight_smile:

2 Likes

More stuff about functions here
http://wiki.compilgames.net/doku.php/gdevelop5/events/functions

1 Like

I have looked at that page more than once, but I never followed the note here: Return values of functions [GDevelop wiki]

It makes functions much more interesting.

Thank you for keeping the forums clean. :wink: