Code: Select all
#SingleInstance, force
SetControlDelay, -1
SetBatchLines, -1 ; for delay precision
stopped := true
myScore = 0
global h_midiout := midiOutOpen(0)
Word_for_Use := ["diffluence","predeluded","gonopodial","escalation","graysville","hermosillo","primaquine","bounceably","creaseless","unstirring","bananaland","homebodies","fastuously","terreplein","effectible","irrigative","uncognized","cancelling","predescent","precontend","condensary","haddington","persistent","smudgeless","powerhouse","uncollared","reimplying","marginated","jutlandish","overharass","gramicidin","commonness","bolshevize","turtledove","supertotal","ijsselmeer","nonzonated","stereogram","alabastron","vocational","undejected","favourably","witchbroom","hammerlike","beneficent","myelinated","kalsominer","promptness","unembossed","miscutting","enduringly","drosophila","averrhoism","roquelaure","dodecanese","fathomless","timberwork","sepulchral","glomerulus","verulamium","lubricious","georgetown","cravatting","attingency","illustrate","antecessor","clarksdale","overargued","watercolor","perpetuate","subovarian","displuming","fumblingly","cicatriser","maupassant","nonbookish","hydrolysis","collotyped","garishness","protoplasm","tabescence","dhaulagiri","defunctive","redivision","shenanigan","evangeline","nonidyllic","continuous","unheralded","cognominal","sousaphone","unbespoken","nonspheric","drumbeater","extirpator","wellington","federalese","rgenopaque","infinitely"]
Rand_Number := RandChar()
gui, Color, 666633
gui, font, s50 Bold, Bauhaus 93
Gui, Add, Text, x250 y10 w150 BackgroundTrans E0x20 vTText, 02:00
Gui, Font
Gui, add, Text, x300 y+20, The new word is:
gui, font, s30, Britannic Bold
Gui, add, Text, x250 w400 y+20 vNew_Word, % Word_for_Use[Rand_Number]
gui, font
Gui, add, Text, x280 y+20, Type here ( Capital matters! ):
gui, font, s30, Britannic Bold
Gui, add, Edit, x150 y+20 w400 vMy_Word,
gui, font,
gui, add, Edit, x10 y+20 w200 h180 vCorrect_Words ReadOnly,
gui, font, s30, Bauhaus 93
gui, add, Text, x+30, Your score:
Gui, add, Text, x+30 w60 vScore, 0
gui, font,
Gui, Add, Text, x260 y+50, To Reload the game, press PageDown
gui, show, w700 h500, Typing Master
Settimer, Stopwatch, 1000
Settimer, KeyStatus, 1000
gosub, Start_Time
return
KeyStatus:
GuiControlGet, new_input,, My_Word
GuiControlGet, old_word,, New_Word
if (new_input <> ""){
stopped := false
gosub, Start_Time
}
if (new_input == old_word){
myScore++
Score_Count(myScore)
Correct_Word(old_word)
Word_for_Use.Remove(Rand_Number)
GuiControl, , My_Word,
Rand_Number := RandChar()
GuiControl,, New_Word, % Word_for_Use[Rand_Number]
}
return
Stopwatch:
timers += 1
if (timers = 120){
GuiControl, , TText , % FormatSeconds(timers)
GuiControl, Disable, My_Word
GuiControl, , My_Word,
stopped := true
gosub, Start_Time
Game_Over()
}
if (timers < 120)
GuiControl, , TText , % FormatSeconds(timers)
return
Start_Time:
if(stopped = true){
Settimer, Stopwatch, off
NumberOfSeconds = 0
}
if(stopped = false)
Settimer, Stopwatch, 1000
return
FormatSeconds(NumberOfSeconds) ; Convert the specified number of seconds to hh:mm:ss format.
{
global
time = 19990101230200 ; *Midnight* of an arbitrary date.
time += -%NumberOfSeconds%, seconds
FormatTime, mmss, %time%, mm:ss
if (NumberOfSeconds <= 109)
NoteOn(9, 62, 127)
if (NumberOfSeconds > 109)
NoteOn(3, 52, 127)
return mmss
}
RandChar()
{
global
Random, Rand, 1, % Word_for_Use.Length()
return, Rand
}
Correct_Word(word)
{
GuiControlGet, new_put,, Correct_Words, Text
new_ver := word "`n" new_put
GuiControl, , Correct_Words, % new_ver
return
}
Score_Count(newScore)
{
GuiControl, , Score, % newScore
return
}
Game_Over()
{
Sleep, 700
NoteOn(2, 60, 127)
sleep 100
NoteOn(2, 62, 127)
sleep 400
NoteOn(2, 62, 127)
sleep 200
NoteOn(2, 71, 127)
}
midiOutOpen(uDeviceID = 1) { ; Open midi port for sending individual midi messages --> handle
strh_midiout = 0000
result := DllCall("winmm.dll\midiOutOpen", UInt,&strh_midiout, UInt,uDeviceID, UInt,0, UInt,0, UInt,0, UInt)
If (result or ErrorLevel) {
MsgBox There was an error opening the midi port.`nError code %result%`nErrorLevel = %ErrorLevel%
Return -1
}
Return NumGet(&strh_midiout)
}
NoteOn(Channel, Note, Velocity) {
DllCall("winmm.dll\midiOutShortMsg", UInt, h_midiout, UInt, 0x90|Channel|(Note<<8)|(Velocity<<16), UInt)
}
PGDN::
Reload
return