I really don't know why you are defining a method to retrieve a variable in the same script command that you are using it.
Why not just:
a = $game_variables[2]
b = $data_enemies[1]
$game_variables[11] =
b.element_ranks[$game_variables[a]]
In any case, space problems are annoying in the event command box. It would make so much more sense for them to give you unlimited horizontal room. Generally, though, try to fit whatever you would normally put on one line on one line through the use of local variables and you'll be fine. That's the best way to avoid those problems.