[PLUGIN] rex_Function2

  • This bug seems be solved in r73

    Found a bug with this plugin. To reproduce it: Create three layouts. On layout2 add On Function "Foo1" -> Make Something like Set Text to "Foo1"

    then add On Start of Layout -> Call Foo1

    On Layout 3 add On Start of Layout -> Set Text to "Layout3". On Layout1 add reference to Layout 2 then Layout3

    Expected result when running : Text is "Layout3" .

    Current result: Text is "Foo1"

    That is, The call to Foo1 is preventing the execution of On Start of Layout for all other layouts after the layout where Foo1 executes.

  • Great :D

    Another thing: Is the plugin minifier safe ? That's because a section of events of my game that uses function didn't work when exporting last time i've tried (for the competition). On preview it works Ok. Your plugin is the only one i like to use so i hope it get's stable and integrated into C2 :D

  • Thank you.

    In example, I put an example of using AJAX and an exported folder by minifier. It works.

    Can you list the properties of function (ex: fn.param["x"], fn.result) used in your application? Maybe I miss something.

  • Well there's no properties i just used the simple on Function and call Function. I'll recheck if the problem is indeed involved with Function plugin.

  • I had tested "Condition:on Function", "Action: Call function", and "Expression: Call" from example in 1st post, work fine after exported with minify.

  • Well it must be another thing then. I thought of Plugin since it's involved in the event. Thanks for helping.

  • Update:

    Add an internal function for integrating with sprite bank plugin.

  • Hey rexrainbow, this is a GREAT piece of work!

    The only thing that's not as I would like it to be is that it's bound to a specific layout.

    I want to call the same function from multiple layouts, but the system won't let me add the same function object to more than one layout.

    Could there be a "global function object" on which I could add function definitions, and call them from any layout? Or simply a way to add the same function object to multiple layouts...

    Thanks!

    Geo

    PS: I will gladly add this functionality if you give me some basic guidance <img src="smileys/smiley4.gif" border="0" align="middle" /> on what and where to modify or add...

  • Geo

    You can set property "Global" to "Yes" in C2 (layout) editor, then this function object will not be destroyed when leaving this layout.

  • Yes, it works if I set it to Global! Thanks!

    Just want to say again that this is one of the most useful plugins, if not THE most useful, once the project reaches a certain size... Thanks for the great piece of work!

  • Geo

    You can insert javascript function into function plugin to do some logic/computing.

    It's more easy to make a "if...else..." or "switch case" in javascript, and there are some useful functions like sorting. Even you can interact with sprite instances in javascript through function plugin.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, I can see the benefits. For now though I'll stick to easy event sheets (even though they're more clumsy) because Javascript is not my thing and it would require ramp up time. When the project gets even bigger <img src="smileys/smiley1.gif" border="0" align="middle" /> and I get more advanced, I'll definitely use this approach. Which I hope will be soon <img src="smileys/smiley2.gif" border="0" align="middle" />

    Cheers!

  • OK I got into some trouble. While trying to clean up the project and to get it organized better, i got into a situation where the function calls stopped working, and I simply can't figure out why.

    Can you please have a look at this very simple capx and help me figure out what I'm doing wrong?

    If I understand correctly, the functions should get called when I click the button. But they don't.

    Thanks in advance.

  • Geo

    Hum... I add a new function object and it works fine.

    I guess that the original function object is not in layout "MainL".

    On the other word, the layout "MainL" can not find the original function object, although the property "Global" is "Yes".

    Global object only can be found if it had been declared already.

    A little suggestion about using "Global" object -- create an empty layout to be the first layout, put all global objects there. And add one event:

    + start of layout
    [ul]
    	[li]go to layout ...
  • Hey Rex thanks for the reply. I still can't get it to work, even after creating a "Globals" layout with an event sheet, putting a new (global) function there and going to main from there.

    I get the feeling that this scenario isn't supported, i.e. having function "definitions" in an event sheet, and calling them from another event sheet. If I'm wrong and this IS possible, I'd appreciate if you could post a little demo capx.

    Thanks again.

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