Its an INSTANCE variable, not a CLASS variable. Class variables have a completely different scope.
To make a variable callable via a script call or whatever, pick a class that is already globally defined, like Game_System, Game_Map, etc. and do something like this:
CODE
class Game_Map
att_accessor :my_variable
end
Actually that is all you really need, but it is important to remember that at this point it is not initialized and is nil, so add something like:
CODE
@my_variable = 3
to Game_Map's initialize method as well.
Now, to access and change it via a script call, you can do this:
CODE
$game_map.my_variable = 5
and
CODE
$game_variables[2] = $game_map.my_variable