Parameters for expressions [plugin dev]

Bugs will be moved here once resolved.

Post » Mon Sep 05, 2011 3:57 am

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
[code]
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");
[/code]

When double clicked from the expression list window appears as :
[code]Sprite.PathFinder.getBoard[/code]
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.Kyatric2011-09-05 04:23:48
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805

Post » Wed Sep 07, 2011 2:23 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Wed Sep 07, 2011 2:38 pm

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".
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805

Post » Wed Sep 07, 2011 8:40 pm

[QUOTE=Kyatric]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 ?[/QUOTE]
My point still stands. What kind of Construct 2 user (when the whole program is aimed at non-programmers) will know what [] means?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Wed Sep 07, 2011 9:21 pm

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

[code]
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
[/code]
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805

Post » Sun Sep 11, 2011 9:56 pm

Ah, finally managed to reproduce. Should be fixed in next build.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Sun Sep 11, 2011 9:57 pm

Awesome, thanks a lot.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,805


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests