Add JS file to Plugin

0 favourites
  • 13 posts
From the Asset Store
Customize the animation of character when item changed
  • Hello!

    I'm trying to create a plugin which will call actions from a JS file (inside the addon package). How can I manage to load this file without rewriting all of its JS inside the instance.js?

    I added it to the "editor-scripts" and "file-list" of the addon.json but when I call a function of the file inside an action in the actions.js it drops an error that the function (of the file) is undefined.

    What am I doing wrong?

    Thanks

  • Editor scripts aren't loaded in the runtime, and adding it to the file list doesn't by itself load it anywhere.

    See specifying dependencies - you probably want to use an inline-script dependency.

  • Editor scripts aren't loaded in the runtime, and adding it to the file list doesn't by itself load it anywhere.

    See specifying dependencies - you probably want to use an inline-script dependency.

    Hi Ashley,

    It worked if using the C3 Runtime, but how can I also do this for games that use the legacy C2 Runtime (on Construct 3)?

    Thanks

  • Unless otherwise noted, everything in the SDK documentation applies to both runtimes.

  • Unless otherwise noted, everything in the SDK documentation applies to both runtimes.

    It is just because when I change the runtime on the same project (empty, only with the plugin added) to C2, it crashes the Construct 3 completely.

    My plugin does not have a c2_runtime folder and in the root plugin.js file I added

    this._info.SetSupportedRuntimes(["c2", "c3"]);
    

    What am I missing?

    Sorry for the silly questions but it is the first time I try to build a C3 plugin.

  • At this point the vast majority of projects are already using the C3 runtime. You could just skip supporting the C2 runtime.

  • At this point the vast majority of projects are already using the C3 runtime. You could just skip supporting the C2 runtime.

    Sure, I agree with you but I need to make this plugin work on C2 Runtime because the platform that I will publish the games does not support the C3 Runtime (specifically webassemly and WebGL 2.0).

    :(

  • Which platform is that? All major browsers have supported WebGL and WebAssembly for some time now.

  • Which platform is that? All major browsers have supported WebGL and WebAssembly for some time now.

    It is KaiOS (kaiostech.com) which is a descendant of FirefoxOS and uses an old engine. I have te opportunity to publish my games there and I must develop a plugin to call their Ads framework because they do not support the eval function that is executed when I call Browser.execJS.

    Can you help me on how to make this plugin possible?

  • My plugin does not have a c2_runtime folder

    You'll need a c2runtime folder with a script named runtime.js in there with the C2 runtime implementation.

    I'd hope sooner or later KaiOS will update the browser engine and then C3 runtime games will work fine on it too!

  • > My plugin does not have a c2_runtime folder

    You'll need a c2runtime folder with a script named runtime.js in there with the C2 runtime implementation.

    I'd hope sooner or later KaiOS will update the browser engine and then C3 runtime games will work fine on it too!

    Yeah, I hope that too!

    And how can I call their library inside the runtime.js inside the c2runtime folder? (as I saw that the way it works is different from calling the script in the c3 plugin)

  • And how can I call their library inside the runtime.js inside the c2runtime folder?

    I don't understand why you're asking - it's all still JavaScript. So, the same way you already are.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > And how can I call their library inside the runtime.js inside the c2runtime folder?

    I don't understand why you're asking - it's all still JavaScript. So, the same way you already are.

    Sorry, english is not my mother language and sometimes I can make some mistakes.

    I meant if there is a way to call their script as a dependency the way it is possible in the C3 (sure it is not the same instructions, but how?).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)