4
<title>A Denemo Keymap</title>
5
<author>AT, JRR, RTS</author>
8
<action>CountSteps</action>
9
<scheme>;;;;;;;;;;;;;;;
11
;; tests interval recognition.
12
(define CountSteps::score 0)
13
(define CountSteps::interval 3)
14
(define CountSteps::start (current-time))
15
(define CountSteps::end (current-time))
16
(define CountSteps::num-goes 30)
17
(define CountSteps::intervalwas #t)
18
(define CountSteps::acceptable_list (list "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))
19
(define CountSteps::note_highest 12)
20
(define CountSteps::note_lowest 0)
21
(define CountSteps::note_position 6)
22
(define CountSteps::userinput #t)
23
(define CountSteps::direction 0)
25
(define (CountSteps::showscore)
26
(d-DirectivePut-score-display "CountSteps::GameScore" (string-append "<b>Score: " (object->string CountSteps::score) "</b> in " (object->string (- CountSteps::end CountSteps::start)) " Secs.")))
28
(define (CountSteps::help)
29
(d-InfoDialog "Count how many steps it takes to get to the next note. Enter this number on they keyboard..... ")
32
(define (CountSteps::GameOver)
33
(d-InfoDialog (string-append "Game Over\n" "Your Score = " (number->string CountSteps::score)))
36
(define (CountSteps::ScoreBoard)
37
(d-InfoDialog (EducationGames::Scoreboard_Pretty_Print
38
(EducationGames::ScoreboardFile "CountSteps")))
41
(CreateButton "CountSteps::GameScore" "<span font_desc=\"12\">Score</span>")
42
(d-SetDirectiveTagActionScript "CountSteps::GameScore" "(CountSteps::ScoreBoard)")
43
(CreateButton "CountSteps::GameHelp" "<b>Help</b>")
44
(d-SetDirectiveTagActionScript "CountSteps::GameHelp" "(CountSteps::help)")
47
;;;;;;;; the main function to run the test - just goes to end and places a note at a random height above the cursor, returning the cursor to where it was.
48
(define (CountSteps::offerNote)
58
(or (> position CountSteps::note_highest)
59
(> CountSteps::note_lowest position))
63
(set! steps (random CountSteps::interval))
67
(set! position (+ position steps))
68
(set! position (- position steps)))
71
(set! position CountSteps::note_position)
74
(set! CountSteps::note_position position)))
76
(if (>= CountSteps::num-goes 0)
78
(set! position CountSteps::note_position)
81
(let gotoEnd () (if (d-NextObject) (gotoEnd)))
83
(d-CursorToNote (EducationalGames::middle_c_offset->lily CountSteps::note_position))
85
(set! CountSteps::intervalwas steps)
87
(CountSteps::showscore)
88
(set! CountSteps::num-goes (- CountSteps::num-goes 1))
92
;;;;;;;;; callback when user chooses a note
93
(define (CountSteps::intervalchosen interval)
95
(set! CountSteps::end (current-time))
96
(let gotoEnd () (if (d-NextObject) (gotoEnd)))
97
(if (= CountSteps::intervalwas interval)
99
(set! CountSteps::score (+ CountSteps::score 1))
100
(EducationGames::PlaceAnswerStatus "CheckMark"))
102
(set! CountSteps::score (- CountSteps::score 1))
103
(EducationGames::PlaceAnswerStatus "CrossSign")))
104
(CountSteps::offerNote)
107
;;;;;;;; the main function to run the test
108
(define CountSteps::runtest
111
(set! CountSteps::userinput (EducationGames::GetAcceptableKeyInput CountSteps::acceptable_list))
112
(set! CountSteps::userinput
113
(string->number CountSteps::userinput))
115
(CountSteps::intervalchosen CountSteps::userinput)
116
(CountSteps::runtest CountSteps::num-goes)))))
119
(define (CountSteps::plus)
120
(set! CountSteps::interval (+ CountSteps::interval 1))
121
(if (> CountSteps::interval 9)
122
(set! CountSteps::interval 9))
123
(d-DirectivePut-score-display "CountSteps::GameInterval"
124
(string-append "<span font_desc=\"12\">Interval: " (object->string CountSteps::interval) "</span>")))
126
(define (CountSteps::minus)
127
(set! CountSteps::interval (- CountSteps::interval 1))
128
(if (< CountSteps::interval 2)
129
(set! CountSteps::interval 2))
130
(d-DirectivePut-score-display "CountSteps::GameInterval"
131
(string-append "<span font_desc=\"12\">Interval: " (object->string CountSteps::interval) "</span>")))
133
(define (CountSteps::setInterval)
134
(set! CountSteps::interval (string->number (d-GetUserInput "Interval" "Give number of steps you want to name note over" (object->string CountSteps::interval))))
135
(if (boolean? CountSteps::interval)
136
(set! CountSteps::interval 8))
137
(if (< CountSteps::interval 2)
138
(set! CountSteps::interval 2))
139
(if (> CountSteps::interval 9)
140
(set! CountSteps::interval 9))
141
(d-DirectivePut-score-display "CountSteps::GameInterval"
142
(string-append "<span font_desc=\"12\">Interval: " (object->string CountSteps::interval) "</span>")))
145
(CreateButton "CountSteps::GameMinus" "<b>-</b>")
146
(d-SetDirectiveTagActionScript "CountSteps::GameMinus" "(CountSteps::minus)")
147
(CreateButton "CountSteps::GameInterval" (string-append "<span font_desc=\"12\">Interval: " (object->string CountSteps::interval) "</span>"))
148
(d-SetDirectiveTagActionScript "CountSteps::GameInterval" "(CountSteps::setInterval)")
149
(CreateButton "CountSteps::GamePlus" "<b>+</b>")
150
(d-SetDirectiveTagActionScript "CountSteps::GamePlus" "(CountSteps::plus)")
157
(EducationGames::Chime)
159
(d-CursorToNote (EducationalGames::middle_c_offset->lily CountSteps::note_position))
161
(CountSteps::offerNote)
162
(set! CountSteps::start (current-time))
163
(CountSteps::runtest CountSteps::num-goes)
165
(EducationGames::Write_Scoreboard_File
166
(EducationGames::ScoreboardFile "CountSteps") CountSteps::score))
167
(CountSteps::GameOver)
168
(CountSteps::ScoreBoard)
171
(EducationGames::Chime)
173
;;;;;;;;;;;;;;;;;;;;;;;;;;
176
<label>Step Counting Exercise</label>
177
<tooltip>%tests your ability to find the number of diatonic notes between two notes</tooltip>