[Solved] Easier to create and deploy extensions

Easier to create and deploy extensions.

As I was experiencing the problem below, I thought it would be more helpful to popularize GDevelop if it became easier to develop and deploy the extension of GDevelop.

It would be nice if we could download the extension from anywhere without rebuilding GDevelop like Unity Store.
If it can’t be done soon, I think it would be good if we could just install extension normally without rebuilding GDevelop.

I’m still a Newbie in Gdevelop, so it’s too much for me to contribute by implementing that :slight_smile:

JsExtensions are made to be built-in, not added dynamically. If you want dynamic extensions use event based extensions.

1 Like

I just wrote a simple logging extension which outputs a string to the console in the DeveloperTools.
So I can simply use this action for verification if a condition is satisfied.
I’m not sure I can write this using on the event based extensions you suggested.

[consoletools]

/**
 * @file
 * Tools for interacting with the debugger.
 */


/**
 * The namespace containing tools to interact with the debugger.
 * @namespace
 */
gdjs.consoleTools = {};

/**
 * Stop the game execution.
 * @param {gdjs.RuntimeScene} runtimeScene - The current scene.
 */
gdjs.consoleTools.log = function(runtimeScene) {
    runtimeScene.getGame().pause(true);
}

gdjs.consoleTools.log = function(anyExp) {
    console.log(anyExp);
};

[JsExtensions]
module.exports = {
createExtension: function(_/*: (string) => string /, gd/: libGDevelop */) {
const extension = new gd.PlatformExtension();
extension.setExtensionInformation(
‘ConsoleTools’,
_(‘Console Tools’),
_(
‘Allow to output to console.’
),
‘CodeQuest(TheGuru)’,
‘MIT’
);

      extension
        .addAction(
          'ConsoleToolsBehavior',
          _('Output any string to console'),
          _(
            'This outputs any string to the console in the DevTools.'
          ),
          _('Output any string to console'),
          _('Console Tools'),
          'res/actions/bug32.png',
          'res/actions/bug32.png'
        )
        .addParameter('string', _('Any String'), '', false)
        .getCodeExtraInformation()
        .setIncludeFile('Extensions/ConsoleTools/consoletools.js')
        .setFunctionName('gdjs.consoleTools.log');

      return extension;
    },
    runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) {
        return [];
    },
}

Why wouldn’t you be able to?

1 Like

I’ve succeeded in making it work!. I just didn’t think I could make it with normal javascript codes :slight_smile:
Thank you!

1 Like