Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ^b::
- ; Welcome to u/UnluckyScarecrow 's AutoHotKey perform macro
- ; Time in miliseconds to wait between notes.
- ; Reference:
- ; 500 = 2 per second ; 333 = 3 per second ; 250 = 4 per second
- ; 200 = 5 per second ; 166 = 6 per second ; 143 = 7 per second ; 125 = 8 per second
- ; Caution - Performance actions may not be able to be used as fast as a song requires, and going too fast may cause notes to be skipped.
- TimeBetween := 166
- ; Map each note to your hotkeys here
- ; Reminder - put ^ before the key to indicate holding Ctrl
- ; Put + before the key to indicate holding Shift
- ; First octave
- CMinus := "1"
- CsMinus := "2"
- DMinus := "3"
- EbMinus := "4"
- EMinus := "5"
- FMinus := "6"
- FsMinus := "7"
- GMinus := "8"
- GsMinus := "9"
- AMinus := "0"
- BbMinus := "-"
- BMinus := "="
- ; Second octave
- CMid := "^1"
- CsMid := "^2"
- DMid := "^3"
- EbMid := "^4"
- EMid := "^5"
- FMid := "^6"
- FsMid := "^7"
- GMid := "^8"
- GsMid := "^9"
- AMid := "^0"
- BbMid := "^-"
- BMid := "^="
- ; Third octave
- CPlus := "+1"
- CsPlus := "+2"
- DPlus := "+3"
- EbPlus := "+4"
- EPlus := "+5"
- FPlus := "+6"
- FsPlus := "+7"
- GPlus := "+8"
- GsPlus := "+9"
- APlus := "+0"
- BbPlus := "+-"
- BPlus := "+="
- ; High C
- CPlusPlus := "]"
- ; The Pause and Stop hotkeys
- StopKey := "x"
- PauseKey := "v"
- ; Put the notes to play in the list below.
- ; Make sure each note is enclused with double quotes. To indicate a pause or blank note, any character that is not recognized as a note will work.
- ; Note that AHK seems to struggle having too many items in a list when compiling. Therefore, you may need to make a second list and combine them. A sample is below.
- NoteList := ["E","-","F","-","G","-","F","-","C+","-","D+","-","C+","-","-","-","B","-","C+","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-","-"
- ,"D","-","E","-","F","-","A","-","F","-","E","-","D","-","-","-","C","-","A-","-","-","-","A-","-","D","-","E","-","F","-"
- ,"G","-","F","-","E","-","D","-","-","-","C","-","D","-","-","-","-","-"
- ,"D","-","E","-","F","-","A","-","F","-","E","-","D","-","-","-","C","-","A-","-","-","-","A-","-","D","-","E","-","F","-"
- ,"G","-","F","-","E","-","D","-","-","-","C","-","D","-","-","-","-","-"
- ,"F","-","-","-","G","-","E","-","-","-","E","-","F","-","G","-","A","-","G","-","F","-","E","F","F","-","G","-","A","-"
- ,"B","-","C+","-","D+","-","C+","-","-","-","A","B","A","B","G","D","A-","D","B","-","-","-","C+","-","A","-","-","-","A","-"
- ,"B","-","C+","-","E+","-","D+","-","C+","-","B","C+","-","-","D+","-","F+","-","E+","-","G+","-","C++","-","F+","-","-","-","-","-","F+","-","-","-","-","-"
- ,"C+","-","F+","G+","A+","-","C+","-","F+","G+","A+","-","B+","-","A+","-","G+","A+","G+","-","E+","-","B","-"]
- NoteList2 := ["D+","-","G+","A+","B+","-","A+","-","F+","-","C+","-","D+","-","-","-","G+","-","F+","-","C++","-","A+","-","G+","-","E+","F+","G+","-"
- ,"A+","-","F+","G+","A+","B+","G+","F+","C+","G+","F+","-","F+","E+","B","E+","B","-","A","-","F","G","A","-","G","-","E","-","G","-","F","-","-","-","C+","D+","F+"] ; I broke a rule at the end of this line
- ; This short loop will merge the two above lists. Copy as many times as needed.
- for Key, Note in NoteList2 {
- NoteList.Insert(Note)
- }
- ; This section translates notes in the list into hotkeys
- for Key, Note in NoteList {
- if NoteList[Key] = "C-" ; FIRST OCTAVE
- NoteList[Key] := CMinus
- else if NoteList[Key] = "C#-"
- NoteList[Key] := CsMinus
- else if NoteList[Key] = "D-"
- NoteList[Key] := DMinus
- else if NoteList[Key] = "Eb-"
- NoteList[Key] := EbMinus
- else if NoteList[Key] = "E-"
- NoteList[Key] := EMinus
- else if NoteList[Key] = "F-"
- NoteList[Key] := FMinus
- else if NoteList[Key] = "F#-"
- NoteList[Key] := FsMinus
- else if NoteList[Key] = "G-"
- NoteList[Key] := GMinus
- else if NoteList[Key] = "G#-"
- NoteList[Key] := GsMinus
- else if NoteList[Key] = "A-"
- NoteList[Key] := AMinus
- else if NoteList[Key] = "Bb-"
- NoteList[Key] := BbMinus
- else if NoteList[Key] = "B-"
- NoteList[Key] := BMinus
- else if NoteList[Key] = "C" ; SECOND OCTAVE
- NoteList[Key] := CMid
- else if NoteList[Key] = "C#"
- NoteList[Key] := CsMid
- else if NoteList[Key] = "D"
- NoteList[Key] := DMid
- else if NoteList[Key] = "Eb"
- NoteList[Key] := EbMid
- else if NoteList[Key] = "E"
- NoteList[Key] := EMid
- else if NoteList[Key] = "F"
- NoteList[Key] := FMid
- else if NoteList[Key] = "F#"
- NoteList[Key] := FsMid
- else if NoteList[Key] = "G"
- NoteList[Key] := GMid
- else if NoteList[Key] = "G#"
- NoteList[Key] := GsMid
- else if NoteList[Key] = "A"
- NoteList[Key] := AMid
- else if NoteList[Key] = "Bb"
- NoteList[Key] := BbMid
- else if NoteList[Key] = "B"
- NoteList[Key] := BMid
- else if NoteList[Key] = "C+" ; THIRD OCTAVE
- NoteList[Key] := CPlus
- else if NoteList[Key] = "C#+"
- NoteList[Key] := CsPlus
- else if NoteList[Key] = "D+"
- NoteList[Key] := DPlus
- else if NoteList[Key] = "Eb+"
- NoteList[Key] := EbPlus
- else if NoteList[Key] = "E+"
- NoteList[Key] := EPlus
- else if NoteList[Key] = "F+"
- NoteList[Key] := FPlus
- else if NoteList[Key] = "F#+"
- NoteList[Key] := FsPlus
- else if NoteList[Key] = "G+"
- NoteList[Key] := GPlus
- else if NoteList[Key] = "G#+"
- NoteList[Key] := GsPlus
- else if NoteList[Key] = "A+"
- NoteList[Key] := APlus
- else if NoteList[Key] = "Bb+"
- NoteList[Key] := BbPlus
- else if NoteList[Key] = "B+"
- NoteList[Key] := BPlus
- else if NoteList[Key] = "C++" ; C++
- NoteList[Key] := CPlusPlus
- else
- NoteList[Key] := ""
- }
- Sleep, 500
- ; Setting default values for pause/stop state
- GetKeyState, state, %StopKey%
- GetKeyState, state2, %PauseKey%
- ; Begin playing
- for Key, Note in NoteList {
- keypress := Note
- keystate := 0
- ; For anybody familiar with AHK, I found that using ^ or + to tell AHK to send Ctrl+ or Shift+ keys wasn't very reliable and missed it often
- ; By sending Ctrl down first, we guarentee it will always be down when it's supposed to.
- ; If anybody knows why this happens, whether it's a quirk of AHK or a quirk of FFXIV, let me know!
- if (SubStr(keypress,1,1) = "^") {
- Send {Ctrl down}
- keystate := 1
- keypress := SubStr(keypress,2,1)
- }
- else if (SubStr(keypress,1,1) = "+") {
- Send {Shift down}
- keystate := 2
- keypress := SubStr(keypress,2,1)
- }
- Sleep, (TimeBetween // 2)
- Send, %keypress%
- Sleep, (TimeBetween // 2)
- if keystate = 1
- Send {Ctrl up}
- else keystate = 2
- Send {Shift up}
- GetKeyState, state, %StopKey%
- GetKeyState, state2, %PauseKey%
- if state2 = D
- {
- ; When the pause key is held down, script enters both loops
- ; When the pause key is released, script exits inner loop
- ; When the pause key is pressed once more, script exits outer loop and resumes play
- Loop {
- if state2 = D
- {
- Loop {
- GetKeyState, state2, %PauseKey%
- if state2 = U
- break
- Sleep, 100
- }
- }
- GetKeyState, state2, %PauseKey%
- if state2 = D
- break
- }
- Sleep, 250 ; Give the user a moment to release the key again
- }
- if state = D
- break
- }
- ; Thank you for using my script. Script by u/UnluckyScarecrow
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement