Computer Science Canada Need help fixing up my CPS test on turing |
Author: | Abel [ Mon Jan 22, 2024 9:35 pm ] | ||
Post subject: | Need help fixing up my CPS test on turing | ||
What is it you are trying to achieve? <Replace all the <> with your answers/code and remove the <>> What is the problem you are having? <Answer Here> Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using <Answer Here> |
Author: | Superskull85 [ 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 <b>Time</b> module and apply <b>Time.Elapsed</b>. 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 <b>Mouse.Where.</b> You should definitely read the <b>Mouse</b> 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 <b>View</b> 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. You can find the online docs at: <a href="http://compsci.ca/holtsoft/doc/">Turing 4.1.1 Documentation</a> |