I have a question, and couldn’t find an answer or example. But I was looking to see if there is a way to call a GDevelop function directly from javascript code.
I’m referring to the custom functions you create, are they accessible via Javascript?
You can use functions from code, but it’s very cumbersome, they’re not meant to be used from JS… after all if you know Javascript you can use Javascript functions which are more powerful
Functions are generated like events in JS functions with a “mangled” name.
Is there any reason why you would call a GDevelop function from a JS function? Any particular reasons?
Because it would be possible for you to find the function name and call it - you can open the debugger and inspect the generated JS files
But this can break if at some point some refactoring is done in the way the function name is generated. It’s not meant to be “public”, at least for now. (hence this is why I’m asking what’s your precise need behind this, to better understand what you’re trying to achieve )
Thanks for your reply and also providing us with an awesome game engine.
I was building a simple Tic-Tac-Toe game and realized building the logic would be easier in Javascript.
But I also wanted the flexibility of configuring a few GDevelop functions, taking advantage of the actions/features available “out of the box”.
I figured it would be quicker to build certain features visually, eliminating the need to search though runtime documentation to do certain things, and also having to rebuild functionality that already exists.
I would then build most of the logic (if-else, switch-case blocks, arrays etc…) in Javascript and call certain GDevelop functions when necessary, via the JS logic I configure.
I know I could do everything in Javascript, but I think it would be faster to build certain parts with the visual editor and the rest with Javascript. This provides the benefit of only having to dig into the runtime/api docs when necessary.
Thanks again for your help and your game engine!
I’ll look into the debugger to see what I can find for my project.