Possibly Array Bug, or just my in experience

Bugs will be moved here once resolved.

Post » Wed Feb 06, 2013 2:34 am

Link to .capx file (required!):
http://empireofgames.net/bugreporting/ArrayIssue.capx

Steps to reproduce:
1. Execute and Click the keyboard button Q. It will than load the array,
you will see the number 500 at the bottom indicating the array is loaded.
2. Now Right click your mouse cursor, do it again
3. It display sets of number in 3 columns. What I have is 9 boxes, and I want 8 boxes are in the boxfamily families group. I want to make it after all the array is deleted, I can sort or somehow find which one is not deleted and use that to load my 1 sprite image there.

Observed result:
The numbers listed to the left is from the while loop, I'm looking to
find the Array index that has value in it because the other one should be deleted already.

The last set of columns are numbers after they have been deleted, why is it still in the array showing up like that?

Expected result:
1. First column should show only 1 index that is not deleted
2. Second column works fine, indicating the value before hand.
3. Third Column I'm expecting it to have a 0 value in the array after it is deleted?

Browsers affected:
Chrome: no
Firefox: no
Internet Explorer: yes/no

Operating system & service pack:
   Windows 7, 64 bit
Construct 2 version:
r114
    
B
7
S
2
G
3
Posts: 39
Reputation: 2,612

Post » Thu Feb 07, 2013 3:15 pm

It's hard to be sure this isn't just a mistake in your events. If there really is a bug in the Array object, it should be possible to demonstrate it in a new project made from scratch with just one or two events. Can you provide this?
Scirra Founder
B
358
S
214
G
72
Posts: 22,946
Reputation: 178,333

Post » Fri Feb 08, 2013 12:33 am

Yes, it was actually from something a little bit bigger, but I left variables in there so it must of been a little bit confusing. I created a simpler one here. Just run it and Right Click and it will generate these boxes from the array position points. The delete before should display these coordinate in order from when they where picked. The deleted after should be 0? because its already deleted from the array. The While loops is suppose to go through the whole array, you can also do i <= Array.Width instead of just < than
Right click once, and re-run the Layout Multiple times and look at the numbers.


http://empireofgames.net/arraysimple.capx
B
7
S
2
G
3
Posts: 39
Reputation: 2,612

Post » Fri Feb 08, 2013 12:35 am

[QUOTE=Gamezilla] Yes, it was actually from something a little bit bigger, but I left variables in there so it must of been a little bit confusing. I created a simpler one here. Just run it and Right Click and it will generate these boxes from the array position points. The delete before should display these coordinate in order from when they where picked. The deleted after should be 0? because its already deleted from the array. The While loops is suppose to go through the whole array, you can also do i <= Array.Width instead of just < than
Right click once, and re-run the Layout Multiple times and look at the numbers.


http://empireofgames.net/arraysimple.capx[/QUOTE]

It could be a family bug or how the text field is bugged in that situation, The While loop I use on my other ones to find out which Array index was not used, because if say I have the Array Width loaded with 9 variables and I only use 8, I would while through and search for the 1 that still contains the coordinate(index not deleted)

-Thanks for listening , you the genius.
B
7
S
2
G
3
Posts: 39
Reputation: 2,612

Post » Fri Feb 08, 2013 1:52 pm

I can't see any evidence this is a bug and not just your events working properly. If there really is a bug in the Array object's 'delete index' action, it should be possible to demonstrate it in a single event. Can you do that?
Scirra Founder
B
358
S
214
G
72
Posts: 22,946
Reputation: 178,333

Post » Fri Feb 08, 2013 10:13 pm

Ok the while loop didn't work correctly because I nested it, but I know thats not the problem.

So it does work right, but as far as the index inside of that, I put a simpler one here.

It seems like you are correct about something not being right about the delete index for arrays. The delete works if its indexinside 0 0 . Indicating that its at that index and value is deleted. Only sometimes does it work though.

There is also a bug with it displaying the index number, why does it not display correctly. Sometimes it does display the indexinside correctly before the values.

http://empireofgames.net/deleteindex.capx

Hit Q for it to randomly generate indexinside for the array.
Do it up to 5 time than restart layout and do it again.
B
7
S
2
G
3
Posts: 39
Reputation: 2,612

Post » Sat Feb 09, 2013 12:05 am

It's working fine Gamezilla. The thing is that deleting the index removes it from the array.


First time you hit 'Q' it deletes index 3 (99 44) and the array looks like this:
0: 150 300
1: 450 300
2: 750 300
3: 40 420
As the 'After Delete' column shows, index 3 is now (40 420)

Hit 'Q' again it deletes index 0 (150 300), index 0 is now (450 300) and array =
0: 450 300
1: 750 300
2: 40 420

Next deletes index 1 (750 300), array =
0: 450 300
1: 40 420

Next deletes index 1 (40 420), there's no index 1 now so it shows (0 0), array =
0: 450 300

Next deletes index 0, array size = 0 now, index 0 = (0 0)
B
54
S
28
G
18
Posts: 1,520
Reputation: 24,990

Post » Sat Feb 09, 2013 1:31 am

Wow Ramones, thanks for the example it surely clear things up for me. The index change after deletion, my assumption was that the array would put 0 value in it or something. I think instead of delete I might have to try to set it 0 0 at that index so that the index array does not change and I can do my thing. Not a bug you can close this Ashley, I think of it as a learning experience.

B
7
S
2
G
3
Posts: 39
Reputation: 2,612

Post » Sat Feb 09, 2013 2:47 am

http://empireofgames.net/arrayindex.capx

I changed it from deleting the index in the array to Set Value, can you tell me why its still not working after I set the value the after delete should be 0 right? I Set Value in it and it does not change the value of the array to 0
B
7
S
2
G
3
Posts: 39
Reputation: 2,612

Post » Sat Feb 09, 2013 3:50 am

@Gamezilla: You're not using a correct syntax to set the value in the array.


This should do the work.
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: 6,998
Reputation: 57,786

Next

Return to Closed bugs

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests