GameMaker Is there a way to assign all of a width of a 2D array at once?

Hi! I'm using an array to design a minimap for my game, but is there any way to assign all of a width or length of a 2D array at once? Like, for example... say we have an array with length 7, width 100; is there a way to set all of [4,(0-100)] at once, each with individual values, or do you HAVE to set them each individually for a 2D array?

I'd just like to save on lines, is all. :p I know it wouldn't be too much more processing power, if any, I just hate how it'd look since the array is huge
 

FrostyCat

Redemption Seeker
Use a for loop.
Code:
for (var i = 0; i < 100; i++) {
  my_array[4, i] = noone;
}
Also, an array of size 100 runs 0 through 99, not 0 through 100.
 

FrostyCat

Redemption Seeker
Problem becomes that I want to be able to set them all to *different* values, which a loop can't do for me
Uhm. As in, one value may be set to 0, another is 1, another is 2, etc, and they don't correlate to position, so it's not a linear scale.
Why would you believe that loops can only produce outputs that follow a strictly linear progression? Here are 2 examples of non-linear output:
Code:
// Generating 100 random numbers from 0-9999, duplicates allowed
for (var i = 0; i < 100; i++) {
  my_array[4, i] = irandom(9999);
}
Code:
// Generating a shuffled sequence from 0-99, no duplicates
for (var i = 0; i < 100; i++) {
  my_array[4, i] = i;
}
for (var i = 0; i < 99; i++) {
  var randn = irandom_range(i, 99),
      randtemp = my_array[4, randn];
  my_array[4, randn] = my_array[4, i];
  my_array[4, i] = randtemp;
}
The problem with your question, as YellowAfterlife has already said, is that your definition of "different values" is way too broad to have a definite implementation. Think over what you mean by that and you should see that the solution has to do with loops.
 
Top