Parameters for expressions [plugin dev]

  • Hi,

    I had setted parameters for expressions of my custom behavior in v51/52.

    It was working as when double clicking the expression in the expression list, the expression would appear followed by ("name_of_parameter") for a string param for example.

    As of r53 and now r54, the expression appears, but not with the parameter.

    Example:

    Editime.js

    AddNumberParam("x", "getBoard[x][]", "1");
    AddNumberParam("y", "getBoard[][y]", "1");
    AddExpression(5, ef_return_string, "Get Board[x][y]", "Results", "getBoard", "Get the content of the cell at submitted X,Y. (1 = obstacle, w = walkable, S = start, D = destination");
    

    When double clicked from the expression list window appears as :

    Sprite.PathFinder.getBoard

    And you have to add the parameters by yourself.

    If you try to use it as it, the tooltip will tell you it is missing parameters and that 2 are expected. But it doesn't appear from the moment you chose it.

  • Does it work if you take out the [] characters?

    You should avoid using [] to indicate arrays anyway - C2's whole reason of existence is to help non-programmers be able to code without coding knowledge. Only programmers know [] means accessing an array, and to non-coders it's totally meaningless. Notice how the Array object avoids that syntax entirely.

  • Removing the [] in the parameter and in the expression declaration has no effect, the parameter is still not displayed when the expression is set from the expression list.

    Anyway, the [] are set in informative strings (set to be displayed for the user not used for the functionning like the naming "getBoard" is) and shouldn't affect the functionning of the behavior, aren't they ?

    This is not blocking, so it can wait.

    Users will have to be a little careful using the behavior until I figure a way to correct this.

    Thank you for your answer and sorry to bother you during your "time off".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anyway, the [] are set in informative strings (set to be displayed for the user not used for the functionning like the naming "getBoard" is) and shouldn't affect the functionning of the behavior, aren't they ?

    My point still stands. What kind of Construct 2 user (when the whole program is aimed at non-programmers) will know what [] means?

  • Oh ok.

    Well then I changed the expressions declaration to using () (as this is the expected form in the end).

    AddNumberParam("X", "getBoard(X,y)", "1");
    AddNumberParam("Y", "getBoard(x,Y)", "1");
    AddExpression(5, ef_return_string, "Get Board(x,y)", "Results", "getBoard", "Get the content of the cell at submitted X,Y. (1 = obstacle, w = walkable, S = start, D = destination)");
    => awaited: getBoard(1,1) | displayed: getBoard
    
    AddNumberParam("Nb", "getRowPathList(Nb)", "0");
    AddExpression(6, ef_return_number, "Get RowPathList(Nb)", "Results", "getRowPathList", "Get the row number of the cell at Nb in the pathlist.");
    => awaited: getRowPathList(0) | displayed: getRowPathList
    
    AddNumberParam("Nb", "getCoLPathList(Nb)", "0");
    AddExpression(7, ef_return_number, "Get ColPathList(Nb)", "Results", "getColPathList", "Get the column number of the cell at Nb in the pathlist.");
    => awaited: getColPathList(0) | displayed: getColPathList
    
    AddNumberParam("Nb", "getCtXPathList(Nb)", "0");
    AddExpression(8, ef_return_number, "Get CtXPathList(Nb)", "Results", "getCtXPathList", "Get the X position of the center of the cell at Nb in the pathlist.");
    => awaited: getCtXPathList(0) | displayed: getCtXPathList
    
    AddNumberParam("Nb", "getCtYPathList(Nb)", "0");
    AddExpression(9, ef_return_number, "Get CtYPathList(Nb)", "Results", "getCtYPathList", "Get the Y position of the center of the cell at Nb in the pathlist.");
    => awaited: getCtYPathList(0) | displayed: getCtYPathList
    
  • Ah, finally managed to reproduce. Should be fixed in next build.

  • Awesome, thanks a lot.

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