this.runtime equivalent in Edittime

  • Hi,

    Is there an equivalent of this.runtime in Edittime, I'm trying to access other edittimes, It can be easily done in the runtime by adding childs to the this.runtime. which is shared by all the plugins.

    But what about the edittime ?

  • No, it's pretty limited. Instances can only access themselves.

    Here's all I've found to be available at edittime:

    I suppose you could make a global js variable and store references there. I think I've tried it one time, but I forget why it didn't work out.

  • R0J0hound what about cr or renderer ? Tried with global var but it didn't work because they're only limited withing the plugin

  • Either of those could be a spot to put a global value, but you may be better off making your own global variable. I think the edittime.js is put inside a closure so vars there aren't global as you say.

    I fount this snippet online as a way to get the global namespace.

    var global=Function("return this")();

    After getting that you can add a global variable with:

    global.myvar=1337;

    Then using something like:

    alert(myvar);

    Should work in any other edittime.js after that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound Unfortunately it didn't work. Is there a way to run JS libraries while on Edittime ?

  • I got it working here. I set a global from one instance and was able to access it from another. Not sure if I can do anything too useful yet beyond that.

    Uou can only run js you include in your edittime or common.js. It's basically just plain js and anything the editor provides.

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