What I'm saying is that the function is executed once every frame and within that frame. At the end of all the functions, the view is updated and the process begins again for the next frame. After all functions currently running are done, the view is updated again. They're run again and the view is updated. At this point, the variable would now have a value of 3 as three frames have passed. Copy this into your script and see for yourself:
var frame_count = 0;
function count_for_me()
{
frame_count += 1;
}
Now add this at the very top of the main function:
fps_max = 10; // 10 frames per second maximum
fps_lock = on; // locks it
count_for_me(); // begins the count
Try playing around with the fps_max value. I prefer you do this in a very simple and empty-looking level or you might run into problems. If you want to toggle the frame rate, add this above the main function:
var max_frame_rate = 10;
function toggle_frame_rate()
{
if (max_frame_rate == 10)
{
max_frame_rate = 15;
fps_max = 15;
return(0);
}
if (max_frame_rate == 15)
{
max_frame_rate = 20;
fps_max = 20;
return(0);
}
if (max_frame_rate == 20)
{
max_frame_rate = 30;
fps_max = 30;
return(0);
}
if (max_frame_rate == 30)
{
max_frame_rate = 60;
fps_max = 60;
return(0);
}
if (max_frame_rate == 60)
{
max_frame_rate = 10;
fps_max = 10;
return(0);
}
}
on_f = toggle_frame_rate();
And when you run your level, press the F key to switch between the different frame rates and see how it affects your value. Of course, to see it, you'll need a panel (add this anywhere above the main function):
panel show_frame_count
{
pos_x = 8; // top left corner
pos_y = 8;
layer = 15;
digits = 0, 0, 7, _a4font, 1, frame_count;
flags = visible; // make it visible
}
From there, you should be set. If you have a moving object visible that moves constantly in your level, you can monitor the frame rate that way. The jerkier it is, the lower the frame rate and the slower the count should increase. The smoother it is, the higher the frame rate and the faster the count should increase.
Hopefully that'll get you somewhere. You might need to modify the code to fix any syntax errors I might've left out.