If you want to count frames, look into the MAINCNT system variable. That will return the number of frames that have passed since SmileBASIC was started, and will continue counting up in the background.