This is very simple. All you have to do to obtain a variable from events is using this line:
So if you want to use variable number 0009 as you used in your first post, simply type:
You can also set values this way, even to strings if you want:
$game_variables[9] = 5
$game_variables[10] = "Hello world"
Hope this helps.