Posted: Sat Dec 21, 2024 6:37 pm Post subject: Re: Need help fixing up my CPS test on turing
I know this an old thread but I was just checking on this site and saw this. Thought I'd take a look for a change of pace and thought maybe someone could learn from it.
Measuring time passed shouldn't be done via a delay. All that does is halt your program; while it is halted, you cannot record any clicks. You should look into the Time module and apply Time.Elapsed. You want to run the program constantly and then check if enough time has passed to deduct 1 second. I'll leave the timer logic to the reader but it tracks time in milliseconds just like when using delay.
Also, you can't measure the mouse position if you want to know if the mouse button was clicked. Additionally, waiting for a button is not what you want either. You can record the properties of all mouse activity without waiting using Mouse.Where. You should definitely read the Mouse module docs too. With that info, you can build a mouse state system using booleans to help with bad click recording. Why this happens because your program is running much faster than you can release the mouse button from the down position to the up position. So you should gatekeep when you record a new click.
Note: the updown and downup events have not proven reliable whenever I use Turing. However, I got this program running fine with a state system and the up and down events.
Finally, you should look into the View module to help reduce screen flicker and it just generally helps when you push a lot of graphical and text updates at a fast speed.