Extending Construct 2 with Javascript

0 favourites
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Any suggestions for basics, stuff for complete noobs to javascript?

  • A good way to learn JS is by just giving it a go, and posting anything you get stuck on at stackoverflow.com

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Arsonide: good tutorial but the expressions are wrong: the return value from expressions is ignored. You need to write PieExp like this:

    Hehe, can you tell I got confused there? I thought I'd read something about expressions being broken, and I noticed the format changed - at least in the text object, between AC and E, and I couldn't figure out from the text object's expression how it was tied with it's "function".

    In a moment I will update the file with your section so there's not more confusion.

  • Another small thing is I noticed a lot of semicolons missing - Javascript does automatically insert missing semicolons, but it's considered bad practice to miss them out - all your statements especially the 'acts["..."] = function () { ... };' should have that trailing semicolon too.

  • Any suggestions for basics, stuff for complete noobs to javascript?

    try http://www.w3schools.com/

    i'm learning from their tutorials

  • just for clarification, this means that if one knows javascript, one can program around a lot of C2's current limitations?

  • Basically.

    Ash, I'm concerned about something I noticed while looking at the Keyboard plugin. Will plugins have to be independently created for each exporter? I noticed that jQuery is used for key events in the keyboard plugin.

  • w3schools is a popular resource, but a LOT of their stuff is out of date and doesn't conform to compliance, theres a big Stackoverflow post about this. I would recommend seeking other resources. See this site: http://w3fools.com/

  • Wait, so we can write plugins with Javascript? This is amazing.

    Will contribute, and will probably use this to eventually create some apps for my site

  • Yeah a lot of experts don't have very good things to say about w3schools - I'd find somewhere else to learn Javascript.

    Arsonide: there's no way around it, you pretty much have to rewrite plugins for each exporter anyway, because there's no one programming language which is ideal for *every* platform. That's why writing an exporter is a lot of work - because it's actually an exporter, runtime, and entire library of plugins!

  • its not too bad. Say you use Java as an exporter you could still use javascript(Rhino) as the scripting language in the exported java exporter. Have it interpret your plugin and all you have to do is generate the code. Its not the fastest way of doing it but highly doable. Basically its all javascript just like in the html5 files. But faster because if you made your own C++ exporter, use V8 for interpreter and there you go. Quick and dirty but it works

    EDIT: but dont interpret javascript in android exporter. That = bad performance

    EDIT2: Will there be support for linux in future?

  • so since w3schools is not good, can somebody suggest better resources for learning javascript?

  • Yes, the MDC (MDN?) is a great reference - if you're googling a query, adding mdc works well for good results.

  • Plugin Dev Question -

    Is it possible to show a user input value in the event editors text for a plugin?

    I looked at the SDK tutorial thing and it says do it like {#} and it uses this like "<b>{1}</b> is 17?" but when i see it in the text it just shows as {1} in bold text. So basically if the user inputs a value of 20 i simply want it to show "20 is 17?" instead.

    Right now i am thinking maybe this is just not added in yet just like expressions seem to be missing also because from the description it seems this is what that does?

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