Created
December 9, 2018 16:48
-
-
Save mamori017/a77efd708dec25ca2ae9702879ee6817 to your computer and use it in GitHub Desktop.
AutoHotkey for Fortnite Discord chat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;----------------------------------------------------------------------------------------------------------- | |
;Startup stuff | |
;----------------------------------------------------------------------------------------------------------- | |
#SingleInstance force | |
Toggle := 0 | |
Typing := 0 | |
;----------------------------------------------------------------------------------------------------------- | |
; Name of discord client and the game client | |
;----------------------------------------------------------------------------------------------------------- | |
dclient := "discord.exe" | |
client := "FortniteClient-Win64-Shipping.exe" | |
;----------------------------------------------------------------------------------------------------------- | |
;Plays a neat toggle sound to confirm if macro is on or not. press the tilde key to toggle | |
;Need to have a sound in the folder below, though | |
;----------------------------------------------------------------------------------------------------------- | |
F1:: | |
If Toggle = 0 | |
{ | |
SoundPlay, C:\Windows\media\Speech On.wav | |
} | |
else | |
{ | |
SoundPlay, C:\Windows\media\Speech Sleep.wav | |
GoSub, Killbox | |
} | |
Toggle := Toggle<1 ? 1 : 0 | |
Return | |
;----------------------------------------------------------------------------------------------------------- | |
;Reload the script | |
;----------------------------------------------------------------------------------------------------------- | |
F2:: | |
Reload | |
Return | |
;----------------------------------------------------------------------------------------------------------- | |
;Custom Hotkeys | |
;----------------------------------------------------------------------------------------------------------- | |
F3:: | |
clipboard = Give you | |
GoSub, SendMacro | |
Return | |
F4:: | |
clipboard = Help! | |
GoSub, SendMacro | |
Return | |
F5:: | |
clipboard = N | |
GoSub, SendMacro | |
Return | |
F6:: | |
clipboard = NE | |
GoSub, SendMacro | |
Return | |
F7:: | |
clipboard = E | |
GoSub, SendMacro | |
Return | |
F8:: | |
clipboard = SE | |
GoSub, SendMacro | |
Return | |
F9:: | |
clipboard = S | |
GoSub, SendMacro | |
Return | |
F10:: | |
clipboard = SW | |
GoSub, SendMacro | |
Return | |
F11:: | |
clipboard = W | |
GoSub, SendMacro | |
Return | |
F12:: | |
clipboard = NW | |
GoSub, SendMacro | |
Return | |
!1:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts north | |
GoSub, SendMacro | |
} | |
Return | |
!2:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts south | |
GoSub, SendMacro | |
} | |
Return | |
!3:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts east | |
GoSub, SendMacro | |
} | |
Return | |
!4:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts west | |
GoSub, SendMacro | |
} | |
Return | |
!`:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts enemy | |
GoSub, SendMacro | |
} | |
Return | |
!5:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts need materials | |
GoSub, SendMacro | |
} | |
Return | |
!6:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts need healing | |
GoSub, SendMacro | |
} | |
Return | |
!/:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts question mark | |
GoSub, SendMacro | |
} | |
Return | |
!y:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts yes | |
GoSub, SendMacro | |
} | |
Return | |
!n:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts no | |
GoSub, SendMacro | |
} | |
Return | |
!o:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts OK | |
GoSub, SendMacro | |
} | |
Return | |
!h:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts here | |
GoSub, SendMacro | |
} | |
Return | |
!t:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts thanks | |
GoSub, SendMacro | |
} | |
Return | |
!v:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts nevermind | |
GoSub, SendMacro | |
} | |
Return | |
!l:: | |
If Toggle = 1 | |
{ | |
clipboard = /tts lol | |
GoSub, SendMacro | |
} | |
Return | |
;----------------------------------------------------------------------------------------------------------- | |
;Hotkey to turn on the chatbox | |
;----------------------------------------------------------------------------------------------------------- | |
MButton:: | |
If Toggle = 1 | |
{ | |
if Typing = 1 | |
{ | |
GoSub, Killbox | |
Return | |
} | |
else | |
{ | |
Typing := 1 | |
Gui,2: +AlwaysOnTop | |
Gui,2:Add,Edit,x0 y0 w500 h20 vS | |
Gui,2:Show,,TTS-to-Discord | |
} | |
} | |
else | |
{ | |
MouseClick, middle | |
} | |
Return | |
;----------------------------------------------------------------------------------------------------------- | |
;Cancels chatbox with ESC | |
;----------------------------------------------------------------------------------------------------------- | |
*Esc:: | |
If Typing = 1 | |
{ | |
GoSub, Killbox | |
} | |
else | |
{ | |
Send {Esc} | |
} | |
Return | |
;----------------------------------------------------------------------------------------------------------- | |
;Submit chatbox with enter or numpad enter | |
;----------------------------------------------------------------------------------------------------------- | |
$Enter:: | |
If Typing = 1 | |
{ | |
GoSub, SendText | |
} | |
else | |
{ | |
Send {Enter} | |
} | |
Return | |
$NumpadEnter:: | |
If Typing = 1 | |
{ | |
GoSub, SendText | |
} | |
else | |
{ | |
Send {NumpadEnter} | |
} | |
Return | |
;----------------------------------------------------------------------------------------------------------- | |
;Functions to send the chatbox and to destroy it | |
;clipboard = /tts %s% | |
;----------------------------------------------------------------------------------------------------------- | |
SendText: | |
gui,2:submit,nohide | |
gui,2:destroy | |
if s is not space | |
{ | |
clipboard = %s% | |
GoSub, SendMacro | |
} | |
Typing := 0 | |
Return | |
Killbox: | |
gui,2:destroy | |
Typing := 0 | |
Return | |
SendMacro: | |
WinActivate, ahk_exe %dclient% | |
WinActivate, ahk_exe %dclient% | |
Send ^v | |
ControlSend,, {Enter}, ahk_exe %dclient% | |
WinActivate, ahk_exe %client% | |
WinActivate, ahk_exe %client% | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment