[PLUGIN] rex_Function2

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • Geo: Did you try to include the event sheet where the definitions are made in the event sheet you're actualy calling the function ?

    That's the way to make code "global".

  • Yes, I had the "function code" on a separate event sheet, which I included both in the global and the main event sheet. It wouldn't work. I'm "refactoring" the project now, using only local functions (almost done actually). Lots of tedious manual replacing of object names, a "Replace all" functionality in C2 would've come real handy <img src="smileys/smiley1.gif" border="0" align="middle" />.

  • Thanks for downloaded function plugin. Has any suggestion about this plugin?

  • Thanks again for the plugin. It is an absolute MUST that I use in all projects.

    I think I found a bug however. Check out this Simple CAPX.

    Basically, it's a function, getting called from another function.

    Run the project:

    Expected result:

    1A#B2A#B3A#B4

    Actual result:

    1A#B#2A#B#3A#B#4

    It seems that the "F2" function gets called twice. Once when it should get called, from within the "F1" function, and once more. I don't understand why it gets called once more, to me it looks like a bug <img src="smileys/smiley1.gif" border="0" align="middle">.

    Or am I missing something?

  • Geo

    Thanks for testing. It might be an engine bug. I'll post this bug latter.

  • Great, hopefully it gets fixed <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Update:

    Fix bug about nested call.

    Geo

    Ashley help me to figure that it's a plugin bug, thanks him.

  • Super! Thanks rexrainbow and Ashley!

  • Update:

    Add version to 1.0.

    Thanks for download this plugin.

  • Try Construct 3

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

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

    I'm not sure if I'm doing something stupid, but I guess I've stumbled upon a problem.

    I was having a problem using functions on a included event sheet.

    Only the first layout had the function working.

    After trying some things, I noticed the Function object appeared on the "layout 1" object list - and not on the others.

    If I remember correctly, the Function plugin used to work like the Mouse plugin, where you add it and it stays above all layouts, not even appearing on the layout's object list.

    I tried changing it to global (another option that's different from Mouse/Touch/etc), but that didn't work. And I couldn't copy & paste it to the other layouts.

    Am I doing something wrong, or is this a bug from the plugin? <img src="smileys/smiley17.gif" border="0" align="middle">

    Thanks a lot for your time, the Function plugin is awesome!

    I made an example for you:

    http://dl.dropbox.com/u/7324985/function_problem.capx

  • Sorry, function plugin is not like Mouse plugin. Function plugin will be destroyed when leave layout.

    You could set "Global" to "Yes" (in your test capx) to keep it alive.

    Hum... it seems many users will be confused.

    The advantage of non-global function is, user can use different function plugin to avoid name collision.

  • Hmmm I may have changed it to "global" on a messy project - It wasn't working when I tested it. Ok, I'll try it tonight and report it here.

    Edit:

    rexrainbow

    Tried the "Global: ON" and it worked! I must have changed something that broke it!

    Thanks a lot Rex, and sorry for taking you time on a stupid matter :

  • Hey rexrainbow, me again <img src="smileys/smiley1.gif" border="0" align="middle" />, been using this plugin HEAVILY in all my projects, I can't imagine life without it <img src="smileys/smiley17.gif" border="0" align="middle" />.

    Now I'm confused about something, and this is the actual ORDER of events and such. More specifically, can you clarify WHEN does the function get called if I place a "call" action?

    I would expect it to be "inline", but it seems it's not.

    Can you please clarify for me when does the function get called, and whether or not it does something to the "context" (i.e. picked objects etc).

    Even more specifically, if I have something like:

    Event button clicked:

        action 1: set variable "spriteCount" to 0

        action 2: call function "destroySprite"

    subevent for each sprite:

          action 1: add 1 to spriteCount

          action 2: textObject -> set text to spriteCount

    Event function called "destroySprite"

        action: sprite -> Destroy

    In the click event, I am calling destroySprite which should destroy my sprites. I would expect that by the time the subevent runs, sprites are destroyed. But actually they are not, they get counted etc.

    On the other hand, if I add a Wait after the function call, it seems that the objects get destroyed by the time the subevent runs.

    Am I getting something wrong?

    I can post simple capx if this is not clear enough.

    Thanks.

  • Geo

    Function plugin dose not change SOL, so that the result of SOL at "on function" is comes from engine. See this post for more detail.

    --

    the event system is not yet designed to allow triggers to access the calling event's SOL.

    --

    Briefly, SOL at "on function" is whole instances of object by default. It can not bypass calling event's SOL anymore.

    One way of bypass SOL is using Instance Group to save SOL by UID. Then you can pick then by Instance Group at "on function".

    Maybe Ashely will provide an api to allow me bypass SOL to "on function".

    Do I catch your problem?

  • Thanks Rex for replying. I don't understand what this SOL is, is there documentation on it?

    But anyway, I don't want the function plugin to work in a certain way, or to change this SOL thing. I just want to understand how it works.

    My testing indicates that the function call is added at the end of the current event "queue", i.e. the call will be executed last, and nothing will be pre-filtered, and no filter that the function does is kept past its scope.

    If that is not correct, please correct me.

    Geo.

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