色々書いてたら出遅れた。

公式質問板のものを参考にして、SRCで連打カウントとか作ってみる。


頑張ればタイピングゲーム的なものとかも作れるかも知れない、とか思ったり
めんどくさそうだと思ったり




↓イベントファイル記述
#その1
#ForとWaitで時間計測

スタート:
cls
回数 = 0
PaintString 120 100 "約5秒間SpeceKey連打"
Wait click
On = 0
あ = GetTime()
#===================
wait start
for i = 1 to 500
 if Keystate(32) = 1 and on = 0 then
  on = 1
  incr 回数 1
 elseif Keystate(32) = 0 and on = 1 then
  on = 0
 endif
 paintstring 120 240 回数
 refresh
 clearpicture 120 200 480 480
 wait until (0.1 * i)
Next
#===================
い = Gettime()
Do
Talk
スコア$(回数);計測時間$(い - あ);SRCを終了してください
SuspEnd
loop


#その2
#DoとGetTimeで時間計測。

#多分Waitとの関係でこっちの方が正確に測れる。
スタート:
cls
回数 = 0
PaintString 120 100 "ほぼ5秒間SpeceKey連打"
Wait click
On = 0
あ = GetTime()
#===================
do while (gettime() - あ < 5000)
 if Keystate(32) = 1 and on = 0 then
  on = 1
  incr 回数 1
 elseif Keystate(32) = 0 and on = 1 then
  on = 0
 endif
 paintstring 120 240 回数
 refresh
 clearpicture 120 200 480 480
  wait 0.01 //この行を削ればほぼぴったりの時間で止まるがCPUを食うようになる。
loop
#===================
い = Gettime()
Do
Talk
スコア$(回数);計測時間$(い - あ);SRCを終了してください
SuspEnd
loop
exit