If you want to change game variables using scripting (RGSS\2), that is, variables that are assigned through events or the likes, you use :
This is a global object, an array, which holds all the variables, up to 5000 I think.
Such as :
$game_variables[VARIABLE_ID] = new_value
For example: I want to change the variable 50 from 0 to 1.
Now, if you want to wait a set number of frames, I never had to, but I believe (I'd double check if I had access to a reference, but eh) it's a method of the Graphics module. Something like Graphic.wait(10) or something. I'm not sure, but if it does exist, it'll be in the help file under the Graphic module.
I'll get back to you when I get back home.