*disclaimer
636968
postoffice-sound-answer-time.hsp(347)
po.png(290)
po.mp3(344)
; Post Office sound answer time ; copyleft 2017-06-23 sugiura@nagoya-u.jp ; 2018-06-22 注釈つき ; 2019-06-21 mmplay オプション修正 #pack "po.png" #pack "po.mp3" mmload "po.mp3", 0 *settei screen 0, 640, 680 notesel log *main pos 50, 180 picload "po.png", 1 color 255,255,204 boxf 0, 0, 640, 80 pos 150, 10 font "ゴシック", 18, 1 color 0,0,0 mes "Now, you are at the red star." mes "A woman is asking you a question." mes "---------------------------------" font "ゴシック", 18, 1 mes "Woman: \"Excuse me.\"" mes "You: " pos 230, 80 button gosub "Yes?", *po color 255,255,204 boxf 0, 560, 640, 680 pos 100, 560 color 0,0,0 mes "Write the instruction to the post office." button goto "Start", *kaitou ; 解答開始ボタン stop *kaitou cls ; 一旦クリア pos 50, 180 ; 見た目は解答欄の追加と picload "po.png", 1 ; Finishボタンの追加 color 255,255,204 ; 時間の計測スタート boxf 0, 0, 640, 80 pos 150, 10 font "ゴシック", 18, 1 color 0,0,0 mes "Now, you are at the red star." mes "A woman is asking you a question." mes "---------------------------------" font "ゴシック", 18, 1 mes "Woman: \"Excuse me.\"" mes "You: " pos 230, 80 button gosub "Yes?", *po color 255,255,204 boxf 0, 560, 640, 680 pos 100, 560 color 0,0,0 mes "Write the instruction to the post office." ; ここまで同じ ans = "" ; 解答欄の提示 mesbox ans, 500, 80, 1, 0 gosub *RTs ; 時間の計測開始 button goto "Finish", *owari ; 終了ボタン stop *owari gosub *RTe ; 計測を停止し noteadd ans ; 解答を記録 jikan = str(jikan) ; 時間を文字列に変換 noteadd jikan ; 時間を記録 notesave "sound-ans-time.txt" ; ファイルに保存 cls pos 300, 400 font "ゴシック", 18, 1 mes "Thank you!" wait 200 end ; sub ------------------------------------------------------------------ *po mmplay 0 return *RTs ; 計測開始 hajime = 0 ; まず変数を空に ji = 0 hun = 0 byou = 0 miri = 0 ji = gettime(4) ; 秒まででよいかと思ったら、分をまたぐ場合がある hun = gettime(5) ; のみならず時をまたぐ場合もある。 byou = gettime(6) ; 秒の単位まで計測して miri = gettime(7) ; ミリセカンドのレベルで調べる hajime = (hun*60000)+(byou*1000)+miri return *RTe ; リ計測終了 kokomade = 0 ; 変数を空に jikan = 0 jie = 0 hune = 0 byoue = 0 mirie = 0 jie = gettime(4) ; ここのところの変数名を開始時のものと変えた hune = gettime(5) byoue = gettime(6) mirie = gettime(7) ; ミリセカンドのレベルで調べる kokomade = (hune*60000)+(byoue*1000)+mirie if ji < jie : kokomade = kokomade + 3600000 ; もし時間をまたいだ場合は ; 1時間分のミリセカンドを足す jikan = kokomade - hajime ; 引き算をしてかかった時間を計算 return
https://sugiura-ken.org/wiki/