Function parameter limit?

This forum is currently in read-only mode.
0 favourites
  • I get a runtime crash when I go above a specific number of parameters when calling a function from an expression, without fault. Both in r2 and the version prior.

    Is this anything known of? For the exact approach I'm making these functions I want them as expressions.

    EDIT: Construct seems to crash in general if I try to write too much in the Expression window, or at least within the parnethesis of the Function call.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • what's the specific number of parameters, so others can see if happens for them as well?

  • More than 17 it seems.

    Also, as I implied, I tried copying one parameter over and over in the expression editor and CC crashed very quickly. I mean, within not too many paramerers, since Construct will also crash just typing a ridiculously high number on its own.

  • I tried this with 256 param, and it didnt crashed here.

    Edit: I don't see any problems param either, its getting slow, but that's all.

  • And you tried this defining the parameters inside something like a variable, not in an action each?

    I just tried compatibility mode in Windows and Construct went completely frozen just defining too many parameters in the event sheet.

  • I tried it in python

    for i in range(4096):

    Function.AddParam(i)

    I don't think it'll be different if I would use a pv for this, but later I'll try that way.

  • Well yeah, that's not the same way after all. All you should have to do is "set variable: Function.functionname(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)"

    And that, if anything like me, should crash your runtime, or even possibly Construct.

  • Perhaps it is not safe to use the ways I've tried just setting random variables or texts, and I should be using a less object-oriented action?

  • I just did some testing and it seems to be a bug in the way the expression editor checks to see if the function expression is valid or not. For instance, I tried pasting konjak's expression (with the 17 params) into the editor and it wouldn't let me press finish and add the action. From that point on I wasn't able to write any other expressions, even valid calls. Closing the expression editor crased the IDE. Then, I tried making an expression by adding parameters one at a time. It was valid until I added number 20, then the input field became permanently red and wouldn't accept any other expressions, (even just a qouted string) until I closed it and it crashed construct.

    Oh and konjak, do you actually need the return value of the function (like do you want to set the variable to the return value), or are you just calling it in a set variable action (you don't care about the variable) because you want to call it as an expression.

  • What I'm doing is basically replace all my events where I create an Effect and then write 5-10 actions below it, with a function that basically reads:

    Function.create_effect(Layer,X,Y,VariableName,WhatToSetItTo,VariableName,WhatToSetItTo,VariableName,WhatToSetItTo...)

    So I'm only trying to create unrelated actions. Since I'm having CC problems possibly relating to my project's size I want to truncate event sheets in any way I can.

    EDIT: By the way, I created an alternative to it that basically parses strings that say it similar. I just don't know if so much string parsing is inefficient. It's also slightly more cumbersome to type out as an action.

    EDIT 2: I tried calling the function as an expression in a plain "Evaluate" condition, but it didn't help.

  • Why don't you do this in python? It's a lot more readable, especially if there are plenty of attributes.

    If you are not familiar with python, I can help if you want.

  • I forget Python exists. I don't know it, but it seems real simple if combined with Construct.

    How is it, speed-wise, to use a bunch of Python? Like if I made almost the whole behavior of a sprite in it and used as a script.

  • python is almost the same speed, at least in some tests I tried a long time ago, and python also has it's share of quirks. if I had more time I'd volunteer, there might be another plugin coder who'd volunteer, though. For large projects, especially ones where I have some complex sequence of events I would use over and over. I make a custom plugin to do that one thing.

  • Yea, I do the same thing for effects in my game konjak, however I'm still using version 99.72. I just tested it in 99.72 and it's the same result; it seems this is a bug that has been there forever (ie, wasn't introduced with the new function object changes).

    I don't really know how stable the python features are, I've never used them extensively.

    This bug is pretty important to fix.

  • Yeah, python is the same in most of the cases, and if you don't use a function in every tick it's basicly up to you to wich one to use - I usually prefer python, unless I have to create something really quickly.

    If you are not experienced in python, just send me the cap, I can take a look at it later.

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