[Closed]Array value assignment is ignored

0 favourites
  • 8 posts
From the Asset Store
Give your players the chance to choose their own keys or buttons!
  • Link to .capx file (required!):

    docs.google.com/file/d/0B20uobjbjbtgLVY4YzdDbi1kR0U/edit

    Steps to reproduce:

    1. Run the capx and Press Enter to perform the first assignment

    2. A message appears telling you that the value 1 was asigned to the cell, and that the cell now contains the value 1 (this is correct)

    3. Press enter again

    4. A message appears telling you that the value 2 was assigned to the cell and the cell now contains the value 1 (this is wrong, the value was not updated)

    Observed result:

    After the first assignment to that particular position in the array, subsequent assignments never update its value

    Expected result:

    Each assignment should update the value of the array cell

    Browsers affected:

    Chrome: YES

    Firefox: YES

    Internet Explorer: ?

    Operating system & service pack:

    Windows 7 64 bit

    Construct 2 version:

    r135

    NOTES

    • This seems to be caused by asking the value of the very same array position that you mean to update in the condition (notice in the example capx, that at line 2 the position (5,6) is both in a condition and in an action).
    • If you disable the condition "Value at (5,6) = 0" the assignment works correctly
    • If you load the value at 5,6 into a temporal variable before and ask for the value the assignment works correctly (I use this as a workaround to keep my code working)

    Took me a while to find this one because I really did not expect the assignment not to work <img src="smileys/smiley5.gif" border="0" align="middle" />

  • Gentlest and most polite bump.

    At first I thought it was me momentarily forgetting how events work again, but the actions before and after the assignment do run each time.

    Only the assignment seems to be skipped.

  • I'm having the same issue pushing values. All data slots in my array are empty. Definitely a r135 problem.

  • Alcemon: If you the sub-event 3 blank (no conditions) you'll see that the values are correctly assigned/displayed.

    The issue is not with the pushing of values, it seems to be with the logic of the conditions.

    (since anyway you want the action to happen on any return key pressed, why put such conditions in there ?)

    Working example, logging on screen and in browser's console

    herniewise: Either post a bug report or in the how do I forums, but as far as I can tell, arrays are working as expected, the issue might lie somewhere else in your code.

  • Thanks for the reply Kyatric, please read my comments below

    Alcemon: If you the sub-event 3 blank (no conditions) you'll see that the values are correctly assigned/displayed.

    Agree, I say this myself on the bug report

    - If you disable the condition "Value at (5,6) = 0" the assignment works correctly

    Also I would like to say that this is not "purely academic" bug report. I noticed this problem in my live code when I had the following conditions:

    -If cell value equals a certain value, or -> the real condition

    -debug_on -> a debug flag that I use for a special operation mode in my project

    I would not know if the problem is in:

    the array machinery (it does seem to happen only with arrays and not with regular variables) or

    with the logic of events (seems unlikely because some actions at the same level are executed, only the assignment is not) or

    me not understanding something obvious (unfortunately likely)

    But something is clearly amiss here. In any case, if you know the issue exists you could work around it so I don't think that this would block anyone.

    Thanks again for the reply.

  • I'll take a look again at my code. Thanks for the answer!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When the array condition is false the array isn't picked so any actions on the array won't work. If you've only one TestArray you could put in a pick all condition like this:

    <img src="https://dl.dropboxusercontent.com/u/8367729/construct/pics/pickAllArray.PNG" border="0" />

  • Thanks ramones, in the end it was only me not remembering how events work. For one reason I thought that unlike sprites, the arrays did not need to be picked.

    Editing the subject to request the bug to be closed.

    Thanks everyone

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