The big question here is, do you want it to appear as num2 as string or as the value the variable num2 contains?
If you want it as string, you would use this line as second to last line:
Code:
var num1row1 = "num" + string(random1);
If you want the value of the variable num2, you should use arrays, it's exactly what they're for.
Your code would look like this:
Code:
var num;
num[0] = 1;
num[1] = num[0] * 2;
num[2] = num[1] * 2;
num[3] = num[2] * 2;
num[4] = num[3] * 2;
num[5] = num[4] * 2;
num[6] = num[5] * 2;
num[7] = num[6] * 2;
num[8] = num[7] * 2;
var random1 = irandom(8);
var random2 = irandom(8);
var random3 = irandom(8);
var random4 = irandom(8);
var random5 = irandom(8);
var random6 = irandom(8);
var random7 = irandom(8);
var random8 = irandom(8);
var random9 = irandom(8);
var num1row1 = num[random1];
draw_text(0, 0, num1row1);
I also went ahead and changed random_range to irandom_range (the former produces decimals, the latter does not)
and I then optimized irandom_range(0, ...) to irandom(...).
I should also note that using "var variableName = ...;" makes the variable local to the event or script.
Furthermore drawing functions such as draw_text have to be used in a draw event if you want them to have any effect (and you're not using surfaces).
If you're using this code in a draw event though, the random numbers will be different every fraction of a second and the drawn text will constantly change,
because the value of random1 constantly changes.
All of the variable code should be put in the create event and every "var" should be removed.
And as a last note, for loops can optimize readability here.