• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

*CLOSED* Not reading array in order

yothebob

Member
Hello,

I have had little luck here, but I will try again.


I have an array that i stash values to and if there is nothing to stash the index stays an empty string.I draw this to the screen using a for loop (see below). But when it is drawing to the screen it is not drawing in order even though the array is in the right order of parts.

example input array: ["","","",[1,22,375,"TR375 Blk : "],"","",[ 1.50,22,409,"BR100- Blk : " ]]

GML:
for (var i = 0; i < array_length(index_array); i++){
            if index_array[i] != ""{
                draw_part_total(index_array[i,0],index_array[i,1],index_array[i,2],index_array[i,3]);
            }
        }
(draw_part total is basically draw_text_color at a set color of green and alpha of 1 )

I had a nested for loop that worked but that impacted performance. Any ideas of why it isn't working as I anticipated?

Thanks in advance for any help!
 
Last edited:

yothebob

Member
real world example:

the array printed on output terminal :
[ "",[ 3,22,375,"UD P362- Blk U : " ],"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[ 1,22,171,"TR200 Blk : " ],"","","",[ 1,22,239,"Pocket Infill- Blk : " ],"","",[ 1,22,341,"BR100- Blk : " ],"","","",[ 2,22,409,"200EP POW Blk : " ],"","","",[ 51,22,477,"PT1-360- Blk : " ],"",[ 102,22,205,"SP41- Blk : " ],"",[ 1,22,511,"RCB screws - 20 Count Bag : " ],[ 4,22,307,"PVI : " ],"","",[ 4,22,35,"RCB1 : " ],"","","",[ 1,22,69,"SDS Bag 25 - SS Black : " ],[ 1,22,443,"NC-20, Blk : " ],[ 1,22,273,"CW-20 : " ],[ 1,22,137,"CSP- Blk : " ],[ 12,22,103,"LedLok- 5 : " ],"","","","","","","","","" ]

output array.JPG
 

yothebob

Member
you know what I think i just figured it out lol. It is drawing the array right but it looks like their x,y values are nor right.

Thank you!
 
Top