Using Wait Script Call

I am trying to make an event that switches between two pages at random intervals. What I'd like to know is if I can set a variable to a random value (say 60 - 600) and then use this script call: $gameInterpreter.wait(frames);   and then somehow use the value of the variable for "frames".

I've thought about putting in a plug in request, but wanted to see if it could be evented first. I hope my question is clear.
1) use control variable to set a random value


2) DON'T use a script call - use the regular wait command on a parallel process


The wait command will only function in a process that is part of the game loop - nowhere else. and you should not try to enter anything into the game loop by script unless you really know what you're doing...
I feel like maybe I didn't explain well. These are not two separate things. I would JUST use the wait command, but simply as a command, it can only be set to one predetermined value.

I would like, if possible, for the wait time to be set to a random amount of time. That is what the random variable is for, but then, I need to know how to get the randomly generated amount of the variable set as the amount of time to wait. That's why I thought perhaps the script call could work.

If there is no way to set the wait time to a random amount of time, then I will indeed do a plug in request.
pretty sure you would be able to use the script call below

this.wait( $gameVariables.value( ID ) );where ID is the ID of your variable..

The function is defined as follows:

Code:
Game_Interpreter.prototype.wait = function(duration) {  this._waitCount = duration;};
Yay, Dekita's line (minus the spaces) works perfectly! Thank you!
Lol, I only added those to ensure clarity for each function used. 🙂
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/using-wait-script-call.48288/