Depending on how fast a PC is, if FPS is 300, then in a loop, you game will go through the loop 200 times.
If you still want to use waitt(), consider this:
Since there are 16 ticks per second with the waitt function, what you can do is use sleep. If you want a 16-tick precision from a waitt function, divide 1 by 16. That gives you 0.0625. So you can do this in a while loop:
sleep(0.0625);
But, there's another way: using a time variable for wait function.
wait(16) * time;
Since you want to have 16 ticks per second, all you have to do is substitute 16 for wait and multiply by time.
However, since I've tried the wait(16)*time with fps_max, I get different results. Same with sleep, too, so it's not a good ideal to use fps_max as there can be users who wanted to have a faster frame rates per second (in other words, smooth game play).
I'm not sure if the wait(16) * time can be affected by the frame rate, so I only test it with a blank level (a very small hollow cube) and my fps is pretty high. So go ahead and test it:
string _level = <time.wmb>;
font myFont = "Tahoma", 1, 16;
var myVar = 0;
Code:
panel myPanel
{
digits = 20, 20, 2, myFont, 1, myVar;
flags = visible;
}
function main()
{
level_load(_level);;
while(1) // Once the myVar goes up to 16, reset to 0 ans start again.
{
while(myVar < 16)
{
myVar += 1;
sleep(0.0625); // This makes up 16 ticks.
}
myVar = 0;
}
}
Change the code if you like (the level name, for example).