loading
 
'while' loop in VBScript Program
Anonymous
10 years
What is the right way of coding a 'while loop' in the VBScript Program? I would like the program to wait (loop) while the condition is not true (e.g. keyboard key press, 'P' for example).
Anonymous 10 years
When programming in the VBScript module you have to remember that you are already in a loop. Each new frame causes the loop to process again. If you prevent the ending of the loop by putting a while loop in the VBScript it will not allow the system to capture new images and continue processing.

So, the way that you accomplish this is to write conditional statements around variables that maintain what state you are in. In the case of the keyboard you would use a conditional to check for a keypress each time the VBScript is run and perform an action based on that.

STeven.
Anonymous 10 years
Good point Steven.

I just wanted to pause the program until some key is pressed, using the 'while loop'. Is that possible anyway? If not, that's ok.

Cheers
Anonymous 10 years
Yes, you can.

Use the if statement to check to see if the key has been pressed. See the example included below which waits for the CTRL-z key being pressed before the RGB_Filter module is allowed to run.

STeven.
program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index