[Closed]Array value assignment is ignored

Bugs will be moved here once resolved.

Post » Fri Jun 21, 2013 5:49 pm

Link to .capx file (required!):
https://docs.google.com/file/d/0B20uobjbjbtgLVY4YzdDbi1kR0U/edit?usp=sharing

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 Alcemon2013-06-24 08:45:13
B
19
S
4
G
4
Posts: 71
Reputation: 3,913

Post » Sat Jun 22, 2013 6:20 pm

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.
B
19
S
4
G
4
Posts: 71
Reputation: 3,913

Post » Sun Jun 23, 2013 6:52 am

I'm having the same issue pushing values. All data slots in my array are empty. Definitely a r135 problem.
B
22
S
5
G
3
Posts: 25
Reputation: 3,272

Post » Sun Jun 23, 2013 8:25 am

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

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
268
S
96
G
67
Posts: 7,219
Reputation: 73,739

Post » Sun Jun 23, 2013 9:03 am

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


[QUOTE=Kyatric] @Alcemon: If you the sub-event 3 blank (no conditions) you'll see that the values are correctly assigned/displayed.[/QUOTE]
Agree, I say this myself on the bug report
[QUOTE=Alcemon]- If you disable the condition "Value at (5,6) = 0" the assignment works correctly[/QUOTE]

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.


    Alcemon2013-06-23 09:10:26
    B
    19
    S
    4
    G
    4
    Posts: 71
    Reputation: 3,913

    Post » Sun Jun 23, 2013 5:45 pm

    I'll take a look again at my code. Thanks for the answer!
    B
    22
    S
    5
    G
    3
    Posts: 25
    Reputation: 3,272

    Post » Sun Jun 23, 2013 6:32 pm

    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:
    B
    55
    S
    28
    G
    18
    Posts: 1,520
    Reputation: 25,305

    Post » Mon Jun 24, 2013 8:44 am

    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
    B
    19
    S
    4
    G
    4
    Posts: 71
    Reputation: 3,913


    Return to Closed bugs

    Who is online

    Users browsing this forum: No registered users and 1 guest