Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another easy one... Timer problem?
#1
Riddle me this, Batmen...  easy for most, hard for me! When I run this bit of code, I expect Score to be 10,20,30...
If I then delay beyond the 5 seconds allowed and enter N$ again, I expect the score to be 39 (which it is)
But if I then enter N$ again (within the 5 seconds allowed),  I get 50, instead of the 49 I expect.  What am I doing wrong?
Code: (Select All)
Pick = 0
GetInput:
T1 = Timer: '                             start timer
Input N$
Pick = Pick + 1
T2 = Timer '                              read timer again
TimePenalty = Int((T2 - T1) / 5) '        penalty 5 points per second since last input
Score = Pick * 10 - TimePenalty '         calculate score as Pick * 10 - TimePenalty
Print "Pick:"; Str$(Pick); "  t1:"; Str$(T1); "  t2:"; T2; "  Timepenalty:"; TimePenalty; "  Score:"; Score
GoTo GetInput
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
Another easy one... Timer problem? - by PhilOfPerth - 03-19-2025, 04:04 AM
RE: Another easy one... Timer problem? - by bplus - 03-19-2025, 10:53 AM
RE: Another easy one... Timer problem? - by bplus - 03-19-2025, 11:24 PM
RE: Another easy one... Timer problem? - by Pete - 03-20-2025, 01:16 AM
RE: Another easy one... Timer problem? - by Pete - 03-21-2025, 06:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm looking for suggestions to solve the problem! Petr 10 651 02-05-2026, 04:56 PM
Last Post: ahenry3068
  Nth problem with hardware images Ikerkaz 9 481 01-23-2026, 02:58 PM
Last Post: bplus
  Install problem...... jssantoro 6 383 12-17-2025, 08:31 PM
Last Post: madscijr
  maths problem with percentage pmackay 3 528 09-04-2025, 09:57 AM
Last Post: pmackay
  Problem with font in Teletext browser. SquirrelMonkey 7 746 08-27-2025, 11:38 AM
Last Post: BDS107

Forum Jump:


Users browsing this thread: 1 Guest(s)