rexrainbow's Forum Posts

  • Ashley

    FB plugin seems to add something in c2-externs.js.

    // Prevent mangling of FB API
    window.fbAsyncInit = function () {}
    window.FB = function () {}
    window.FB.init = function (i) {}
    window.FB.getLoginStatus = function (r) {}
    window.FB.api = function (q, r) {}
    window.FB.ui = function (q, r) {}
    window.FB.Event = function () {}
    window.FB.Event.subscribe = function (e, r) {}
    window.FB.login = function (r) {}
    window.FB.logout = function (r) {}

    Is it suitable for 3rd part plugin maker to edit this? (Plugin user need to override c2-externs.js)

  • smitchell

    Yes, you can call javascript with jquery in this feature, even you can call function defined in event sheet(Condition:On function) for a callback.

  • dagda825

    I'm not yet up on C2 security, too.

    But I thought, if designer did not create a entry to allow player input string for code injecting, it might be safe.

    Designer just use this feature to create game logic.

  • I test the case of "reading video file in exported folder", it work.

    You can try by these steps.

    1. download test file (movie.ogg) from gonzdevour's link

    w3schools.com/html5/movie.ogg

    2. in capx, assign src url to "movie.ogg", then export capx.

    3. put movie.ogg downloaded (at step1) into export folder (at step2)

    4. open the index.html in exported folder. It works in my testing.

  • Hum... I have no idea about copyright of video if I use the video for a tutorial in this case. Could someone provide a 'safe' video url in *.webm format?

  • Update:

    Update platformMP following r72.

  • Humm... The first part is correct -- using a action to trigger another event.

    The second part -- runtime.trigger() is being called recursively, I'm not sure. From my trace, "runtime.trigger()" seems to change the value of "sheet.hasTriggered". It might cause a bug with "include event sheet".

  • Update:

    Add "action: Inject JS function objects" for advance user. You can pass a code string. Plugin will use eval to parse it then execute it.

    Example

    The code string is

    function(fn)
    {
        var my_add = function(fn)
        {
            fn.result = fn.param[0] + fn.param[1];
            fn.CallFn('message', 'I\'m at js function');
        };
        fn.InjectJS('my_add', my_add);
    }

    1. This code string is a function with one input parameter named 'fn' which is a part of function plugin.

    2. Use command 'fn.InjectJS' to assign a js function into function plugin.

    In this example:

    fn.InjectJS('my_add', my_add);
    • User can use 'action:call "my_add"' in event sheet to execute this js function

    3. The 'my_add' function has a input parameter named "fn". It is the same as 'fn' at previous.

    • 'fn.param' is to get the value set by 'action: set parameter'
    • 'fn.result' is to set the value got by Function.Result.
    • 'fn.CallFn(name, param0, param1)' can call any function defined in this function plugin, even in event sheet. In this example, it will call 'message' which is defined at event sheet to append some text at text object. Oh, it can return the value set by 'action: set Result'.

    This feature can not let you control every objects in javascript. User can use javascript as game logic, and call 'fn.CallFn' to interact with other objects, or get some values from event sheet.

    The API of internal function object (using in JS) are listed below.

    A. set parameters, returns

    • fn.param

    :: input parameters, a hash

    • fn.ret

    :: return values ,a hash

    • fn.result

    :: return value, single value

    B. call function

    • fn.CallFn(name, param0, param1...)

    C. inject javascript function

    • fn.InjectJS(name, fn)

    Additional:

    When the name of javascript function is the same as the function defined in event sheet, the function plugin will execute javascript function first, then the event sheet one.

    If the javascript function return true, function plugin will not continue to execute the event sheet one. You can use this trick to do some checking/preprocessing before running the function defined in event sheet.

  • Hi,

    In this post, Kiyoshi find a bug in my function plugin.

    In this case, user include 2 event sheets.

    1. In 1st included event sheet, user use action to trigger the event.

    2. After step 1, the 2nd included event sheet can not run.

    I trace the execution flow in firebug. I guess -

    1. the action to trigger event will scan all events in the sheet, include "include" sheets.

    --> And mark the sheet.hasTriggered = true

    2. now turn to normal execution, engine try to execute the next included sheet. but the

    sheet.hasTriggered == true

    in eveng.js, line 1453

    if (sheet.hasTriggered)
        return false; 

    So engine skip this sheet.

  • Thanks.

    I trace this case, but I can not fix it. The error seems come from engine. I will report to

  • Uh, yes, the server mainly wrote by python, it can port to linux.

    You can discuss with l33twash0r at this thread.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hummm... yes, it's inconvenient.

    You can stay the server always running without closing it. Then the ip address will always valid.

    I don't know how to solve it. We still need a server, the different is the location of server, at home ... or on cloud?

  • Thanks.

    Function plugin is important for me, not only to save events, but also to save the time of making plugin by combining with other plugins like [behavior] timer, [plugin] timeline, [plugin] worksheet, and [plugin] sync-function.

  • It's very powerful! Thanks.

  • For example of function plugin using in event sheet, it can be found at the first post of this thread.

    For example of injecting javascript, hum... I need some days to prepare, actually, it is not completed yet.

    Currently, I'm trying to make another plugin, to handle the game logic in javascript. Maybe it's more suitable then injecting javascript code in function.