Hi and welcome to the GMC!
The way you described to tackle your problem sounds good to me.
In order for us to tell how to get the sprite of a certain block, we need to know how you represent blocks.
In case you represent blocks as object instances, you could probably do something like this:
Code:
var counts, tetromino_amount = 7;
counts[tetromino_amount - 1] = 0;
var cy = line_y;
for(var cx = leftmost_x; cx < rightmost_x; cx += cell_width) {
with instance_position(cx, cy, obj_tetromino) {
var index = -1;
switch sprite_index {
case spr_tetromino_I:
index = 0;
break;
case spr_tetromino_O:
index = 1;
break;
...
}
counts[index]++;
}
}
var maxcount = 0;
for(var i = 0; i < tetromino_amount; ++i) {
maxcount = max(maxcount, counts[i]);
}
var score_bonus = maxcount * 50;
where leftmost_x is the x coordinate of the leftmost cell in the tetris field,
righmost_x is the x coordinate of the right edge of the field,
line_y is the y coordinate of the blocks on the line you're checking,
obj_tetromino is a parent object of all block objects,
spr_tetromino_* is a sprite of a tetromino,
tetromino_amount is the amount of tetromino sprites
and score_bonus is the score you get for completing the line.