Javascript Plugin and Behavior SDK documentation

0 favourites
From the Asset Store
Easily integrate Telegram Mini Apps SDK into your Construct 3 projects for building interactive apps and games.
  • <font size="5">This thread is being retired since the SDK is now hosted in the Manual section of the site. Click here to visit the online SDK documentation.</font>

    Old thread is below for archiving's sake. This post content is now out of date - the above link is now the latest version of the SDK documentation.

    ===================

    Plugins and behaviors can be written for Construct 2 in Javascript. Since there's been some plugin work already - and I myself keep forgetting how it works - I've been writing up some documentation for the SDK.

    HTML5 Javascript SDK and documentation

    Also, user Kyatric has kindly compiled a HTML version of the SDK documentation viewable online.

    Last update: 28th November 2011

    This is currently some very lo-fi text files, but the content is there. There are also templates to help get you started with a plugin or behavior. In future, it'll all be hosted on the site, linked up, and so on.

    Let me know if you have any problems, find anything confusing, or get stuck - we're more than happy to help!

  • Oh, just a heads up: there are some SDK changes in r51, and the docs are written as if those have already been made. Next build should be out soon then these docs are current.

  • Thank you Ashley. Hopefully more devs will look into making plugins and behaviors for C2.

    I have a suggestion here, adding a "version" field to the plugin settings. This might help for future iterations over existing plugins.

  • i was waiting for this!

  • Hey Ash, when I try and compile I get told that my Plugin ID is missing. But I defined it in the runtime.js

    Any thoughts?

    Also, is there any way to directly inject JS through a plugin? As in the user defines a JS script to be executed as an event.

  • If you have incorrect javacript (syntax error probably) in your plugin's code, you might get the plugin ID error.

    Be sure to go through The MDN guide for javascript. The basics can be learnt in a couple of days if not less.

    Also be sure that the string defined in "id" field in edittime.js is the same when defining the plugin class.

    Example:

    edittime:

      "id": "loL",

    runtime:

    /////////////////////////////////////
    // Plugin class
    cr.plugins.loL = function(runtime)
    {
         this.runtime = runtime;
    };
    
    (function ()
    {
         var pluginProto = cr.plugins.loL.prototype;
    
  • Also, is there any way to directly inject JS through a plugin? As in the user defines a JS script to be executed as an event.

    Yes, through the eval() function, but if done incorrectly this can open up security vulnerabilities, and might not survive the minifier. So I don't think you should do this.

  • Updated the original link - the docs now include the runtime side. This should cover just about everything for now! When the site has a manual section I'll port all the content over so it's a bit more readable. All the content is there right now though.

  • Choice timing!

    Hey Ashley, just wanted to join the chorus of appreciation for making such an inspiring piece of software, and including your diligence on all matters for building such a cool community around it. Really well done. [=D>]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you Ashley, this is very helpful.

  • Thanks I7redd, nice to hear :)

    BTW updated the link, forgot a section - "14 Reference - cr functions". Covers cr.vector2, cr.rect etc.

  • I made a html version of the SDK

    It goes to the "tome" 8 as of now.

    i'll add the references later next week.

    If you want to download it click this link that will give you a .zip

    Written by Ashley, HTML formatting by myself.

    Enjoy.

  • Updated the link in the OP - recent builds introduced some changes so those are now reflected in the new docs.

  • I could use a "version:" attribute for GetBehaviorSettings().

    Also, the "help" button should work like the native plugins, instead of displaying "help on expressions".

  • Updated the SDK in the OP once more: now there are templates for a behavior and plugin. This should be a useful starting point for anyone looking to write a behavior or plugin.

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