Can you include new scripts with the edittime?

0 favourites
  • 6 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • Is there a way to include a javascript(s) in the edittime.js without it getting used for the runtime.js also and then built into the exported project like the common.js does.

    I did try the regular JS ways to include other files but i get errors which i think must be because it is using V8 for edittime. Basically i would like to have some common functions in a separate javascript but use it only with the edittime rather than getting it included.

    Maybe there is a way to do this or change the common.js settings to only include with either the edittime or runtime?

    If this is not possible i would like to request this as it would be very useful to me, many thanks.

  • FireLight

    1) If you only want to include the code in edittime.js and not in runtime.js, why can you not simply code it directly into edittime.js itself?

    2) What exactly are you wanting to include in your edittime.js?

    3) Why do you call them "common functions"? What are they common to? (common.js is necessarily common to both edittime.js and runtime.js - that's what 'common' means, but what does it mean for you?)

  • Most javascript libraries (e.g. jQuery) assume they are being used in a browser. Construct 2's edittime script is a pure V8 context with no browser, which means very very few Javascript libraries will work in it. Which library are you considering?

  • FireLight

    1) If you only want to include the code in edittime.js and not in runtime.js, why can you not simply code it directly into edittime.js itself?

    2) What exactly are you wanting to include in your edittime.js?

    3) Why do you call them "common functions"? What are they common to? (common.js is necessarily common to both edittime.js and runtime.js - that's what 'common' means, but what does it mean for you?)

    1) Because i want it organized and like to use multiple scripts, it makes things much easier to organize and update projects that way.

    Also as i said the common.js already offers this and it would otherwise be perfect for my needs however it has the problem i posted above in that it adds all the extra code to the exported project. Why would one want to use common.js and add to the exported projects file size when that shouldn't be needed on the edittime side though?

    2) Various things depending on the plugins, everything from simple value limiting and variable storage to graphical things like drawing GUI controls.

    Sure i could pack a load of code into a single file but then as the complexity grows the project gets messy, no doubt that is why scirra's own framework is split into multiple parts rather than in one huge js file. Basically i like organized projects where i can quickly find things, if you could set ../ on the path you could also use it across multiple plugins.

    3) I was not referring to the common.js script, by that i mean commonly used functions (a library of functions basically).

    The bottom line here is however i read a post where the developers of this program asked what features plugin developers wanted to help make this the best game development tool, i need this feature so i though requesting it would be a good idea. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Most javascript libraries (e.g. jQuery) assume they are being used in a browser. Construct 2's edittime script is a pure V8 context with no browser, which means very very few Javascript libraries will work in it. Which library are you considering?

    Thanks for your reply, I will be making my own library based around the current features doing various tasks i might need to use on the edittime.js side.

    I was also planning on using some external things such as encryption etc so it just decrypts the strings on the runtime side. There would probably be other things i would do if this feature was available though, i mentioned a few other reasons why i think this would be a great option above before i read your post also.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • FireLight

    Thanks for your explanation/clarification. You've butted up against one of the inherent limitations of JavaScript running in a non-browser environment viz. its lack of an import/include/require facility, like that enjoyed by C/Java/Perl/PHP ....

    Until JavaScript adds this (or the Scirra team modifies their engine to provide for loading an edithelper.js, as for common.js), dropping in the source code itself would seem to be your only option

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