Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;;;;;;;;;;;;;;;;; Includes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- if not A_IsAdmin
- {
- Run *RunAs "%A_ScriptFullPath%"
- ExitApp
- }
- #SingleInstance force
- #InstallKeybdHook
- #InstallMouseHook
- #NoEnv
- #If !isMouseShown() and WinActive("Darkfall Unholy Wars")
- ;;;;;;;;;;;;;;;;;;;;; Text to Speech ;;;;;;;;;;;;;;;;;;;;;;;
- ttsEnabled = true
- ttsVolume = 100
- Menu, Tray, Add, Add Hotkeys, run
- ;;;;;;;;;;;;;;;;;;;;;;;;; Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;
- config=
- (
- [Hotkeys]
- mountLeft=Left
- mountRight=Right
- [version]
- major=2
- minor=0
- [Togglekeys]
- autoFire=+^LButton
- instaCast=+^RButton
- insta=0
- auto=0
- [Filepath]
- loc=
- )
- IfNotExist, c:\DFscript\config.ini
- {
- FileCreateDir, C:\DFscript
- FileAppend %config%, c:\DFscript\config.ini
- }
- Loop, %A_Appdata%\VideoOptions.cfg, , 1
- {
- if(A_LoopFileTimeModified>Rec)
- {
- fileloc=%A_LoopFileFullPath%
- Rec=%A_LoopFileTimeModified%
- }
- }
- if(fileloc = Error)
- {
- MsgBox, "Could not locate VideoConfig.cfg" -- Check forums for issues `n Press Ok to close script.
- ExitApp
- }else{
- IniWrite, %fileloc%, c:\DFscript\config.ini, Filepath, Loc
- }
- Loc := getIni("c:\DFscript\config.ini", "Filepath", "Loc")
- actionL := "Action.TriggerLeftCurrentAction"
- actionR := "Action.TriggerRightCurrentAction"
- quick5 := "Action.ActivateQuickItem5"
- Lradial1 := "GUI.SelectLeftRadialSlot1"
- Lradial2 := "GUI.SelectLeftRadialSlot2"
- Lradial3 := "GUI.SelectLeftRadialSlot3"
- Lradial4 := "GUI.SelectLeftRadialSlot4"
- Lradial5 := "GUI.SelectLeftRadialSlot5"
- Lradial6 := "GUI.SelectLeftRadialSlot6"
- Lradial7 := "GUI.SelectLeftRadialSlot7"
- Lradial8 := "GUI.SelectLeftRadialSlot8"
- Rradial1 := "GUI.SelectRightRadialSlot1"
- Rradial2 := "GUI.SelectRightRadialSlot2"
- Rradial3 := "GUI.SelectRightRadialSlot3"
- Rradial4 := "GUI.SelectRightRadialSlot4"
- Rradial5 := "GUI.SelectRightRadialSlot5"
- Rradial6 := "GUI.SelectRightRadialSlot6"
- Rradial7 := "GUI.SelectRightRadialSlot7"
- Rradial8 := "GUI.SelectRightRadialSlot8"
- FileDelete, c:\DFscript\version.ini
- URLDownloadToFile, http://pastebin.com/raw.php?i=EU0zv5nS, c:\DFscript\version.ini
- global Nmajor := getIni("c:\DFscript\version.ini", "version", "major")
- global Nminor := getIni("c:\DFscript\version.ini", "version", "minor")
- global major := getIni("c:\DFscript\config.ini", "version", "major")
- global minor := getIni("c:\DFscript\config.ini", "version", "minor")
- update(major, minor)
- {
- FileCopy, DFscript.ahk, *.bak
- FileCopy, functions.ahk, *.bak
- URLDownloadToFile, http://pastebin.com/raw.php?i=fNJMTXTc, DFscript.ahk
- URLDownloadToFile, http://pastebin.com/raw.php?i=HaziAzKp, functions.ahk
- IniWrite, %Nmajor%, c:\DFscript\config.ini, version, major
- IniWrite, %Nminor%, c:\DFscript\config.ini, version, minor
- return
- }
- GetKey(bind, fileLoc)
- {
- FileRead, configVar, %fileLoc%
- if not ErrorLevel
- {
- StringGetPos, startPos, configVar, %bind%
- StringTrimLeft, newfile1, configVar, startPos
- StringGetPos, startPos, newfile1, `;
- StringTrimLeft, newfile1, newfile1, startPos
- StringGetPos, endPos, newfile1, `,`&
- total := StrLen(newfile1)
- StringTrimRight, newfile1, newfile1, total - endPos
- StringReplace, newfile1, newfile1, `,, +
- Loop, Parse, newfile1, `;
- {
- keyV := A_LoopField
- Loop, Parse, keyV, +
- var%A_Index% := A_LoopField
- }
- FileRead, keylist, keylist.txt
- if not ErrorLevel
- {
- Loop, Parse, keylist, `~, %A_Space%
- if RegExMatch(A_LoopField,"^(" var1 ")=(.*)$",found)
- key1 := found2
- Loop, Parse, keylist, `~, %A_Space%
- if RegExMatch(A_LoopField,"^(" var2 ")=(.*)$",found)
- key2 := found2
- global key3 := key1 key2
- }return, %key3%
- }
- }
- isMouseShown()
- {
- StructSize := A_PtrSize + 16
- VarSetCapacity(InfoStruct, StructSize)
- NumPut(StructSize, InfoStruct)
- DllCall("GetCursorInfo", UInt, &InfoStruct)
- Result := NumGet(InfoStruct, 8)
- if Result
- return 1
- else
- return 0
- }
- SAPI := ComObjCreate("SAPI.SpVoice")
- SAPI.volume := 100
- say(msg)
- {
- global ttsEnabled
- if(ttsEnabled == "true")
- {
- global SAPI
- SAPI.speak(msg,1)
- }
- }
- getIni(config, section, key)
- {
- IniRead value, %config%, %section%, %key%
- return value
- }
- ;;;;;;;;;;;;;;;;;;; Update Check ;;;;;;;;;;;;;;;;;;;
- if (major < Nmajor) or (major = Nmajor and minor < Nminor)
- {
- Gui 2: Add, ActiveX, x0 y0 w980 h600 vWB, Shell.Explorer
- WB.Navigate("http://www.ahkgaming.com/changelog.html")
- Gui 2: Add, Button, x0 y600 w327 h40 , View Source (2 files)
- Gui 2: Add, Button, x654 y600 w327 h40 , Download Update
- Gui 2: Add, Button, x327 y600 w327 h40, Cancel
- Gui 2: Show, Center h640 w980, New Update Available
- return
- }
- 2ButtonCancel:
- Gui, 2: Hide
- ;;;;;;;;;;;;;;;;;;; Welcome Message ;;;;;;;;;;;;;;;;;;;
- ;welcomeMsg = Welcome to Darkfall.
- ;say(welcomeMsg)
- ;;;;;;;;;;;;;;;;;;;;; ini check ;;;;;;;;;;;;;;;;;;;;;;;;
- major := getIni("c:\DFscript\config.ini", "version", "major")
- minor := getIni("c:\DFscript\config.ini", "version", "minor")
- ;;;;;;;;;;;;;;;;;;;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;
- global leftAction := GetKey(actionL, Loc)
- global rightAction := GetKey(actionR, Loc)
- spawnMount := GetKey(quick5, Loc)
- autoFire := getIni("c:\DFscript\config.ini", "Togglekeys", "autoFire")
- instaCast := getIni("c:\DFscript\config.ini", "Togglekeys", "instaCast")
- auto := getIni("c:\DFscript\config.ini", "Togglekeys", "auto")
- insta := getIni("c:\DFscript\config.ini", "Togglekeys", "insta")
- mountLeft := getIni("c:\DFscript\config.ini", "Hotkeys", "mountLeft")
- mountRight := getIni("c:\DFscript\config.ini", "Hotkeys", "mountRight")
- ver := getini("c:\DFscript\config.ini", "version", "ver")
- mounted := false
- if(spawnMount)
- {
- Hotkey, ~%spawnMount%, spawnMount
- }
- if(mountLeft)
- {
- Hotkey, %mountLeft%, mountLeft
- }
- if(mountRight)
- {
- Hotkey, %mountRIght%, mountRight
- }
- loop, 8
- {
- variables := GetKey(Lradial%A_Index%, Loc)
- Hotkey, ~%variables%, left1
- }
- loop, 8
- {
- variables := GetKey(Rradial%A_Index%, Loc)
- Hotkey, ~%variables%, right1
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;; Hotkey Section ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ^+LButton::
- if(auto == true)
- {
- say("auto fire deactivated")
- auto := false
- }else{
- say("auto fire activated")
- auto := true
- }
- return
- ^+RButton::
- if(insta == true)
- {
- say("insta cast deactivated")
- insta := false
- }else{
- say("insta cast activated")
- insta := true
- }
- return
- spawnMount:
- mounted := true
- return
- left1:
- wheel = 1
- mounted := false
- return
- right1:
- if(insta)
- {
- mounted := false
- wheel = 1
- sleep 250
- send, {%rightAction% down}
- sleep 150
- send, {%rightAction% up}
- return
- }else{
- mounted := false
- wheel = 2
- return
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;; Action Center ;;;;;;;;;;;;;;;;;;;;;;;;;;;
- *RButton::
- if(mounted)
- {
- if(auto)
- {
- Loop
- {
- GetKeyState, press, RButton, P
- If press = U
- Break
- Send, {%rightAction% down}
- sleep 150
- Send, {%rightAction% up}
- sleep 20
- }
- }else{
- send, {%rightAction% down}
- KeyWait, Rbutton, Up
- send, {%rightAction% up}
- return
- }
- }else{
- Send {Rbutton down}
- KeyWait, Rbutton, Up
- Send {Rbutton up}
- return
- }
- *LButton::
- if(wheel = 1)
- {
- if(auto)
- {
- Loop
- {
- GetKeyState, press, LButton, P
- If press = U
- Break
- Send, {%leftAction% down}
- sleep 150
- Send, {%leftAction% up}
- sleep 20
- }
- }else{
- send, {%leftAction% down}
- KeyWait, Lbutton, Up
- send, {%leftAction% up}
- return
- }
- }else if (wheel = 2)
- {
- send, {%rightAction% down}
- KeyWait, Lbutton, Up
- send, {%rightAction% up}
- wheel = 1
- return
- }
- mountLeft:
- send, {%leftAction% down}
- sleep 100
- send, {%leftAction% up}
- return
- mountRight:
- send, {%rightAction% down}
- sleep 100
- send, {%rightAction% up}
- return
- #if
- ~esc::
- if (isMouseShown())
- {
- IniWrite, %auto%, c:\DFscript\config.ini, Togglekeys, auto
- IniWrite, %insta%, c:\DFscript\config.ini, Togglekeys, insta
- Reload
- }
- return
- run:
- Gui, Add, GroupBox, x56 y47 w190 h110 , Extra Mount Keys (Optional):
- Gui, Add, Text, x66 y67 w90 h20 , Mount Left:
- Gui, Add, Text, x66 y97 w90 h20 , Mount Right:
- Gui, Add, Hotkey, x166 y67 w70 h23 vmountLeft, %mountLeft% ;left action
- Gui, Add, Hotkey, x166 y97 w70 h23 vmountRight, %mountRight% ;right action
- Gui, Add, GroupBox, x56 y167 w320 h150 , Toggle Keys
- Gui, Add, Text, x66 y197 w110 h20 , Toggle AutoFire:
- Gui, Add, Hotkey, x196 y197 w120 h23 vautoFire, %autoFire%
- Gui, Add, Text, x66 y257 w110 h20 , Toggle Inst-Cast:
- Gui, Add, Hotkey, x196 y257 w120 h23 vinstaCast, %instaCast%
- Gui, Add, Text, x76 y220 w150 h20 , Default: ctrl+shift+Lbutton
- Gui, Add, Text, x76 y280 w160 h20 , Default: ctrl+shift+Rbutton
- Gui, Show
- return
- 2ButtonDownloadUpdate:
- update(Nmajory, Nminor)
- Reload
- return
- 2GuiClose:
- ExitApp
- 2ButtonViewSource(2files):
- run http://pastebin.com/raw.php?i=fNJMTXTc
- run http://pastebin.com/raw.php?i=HaziAzKp
- return
- GuiClose:
- Gui,Submit
- IniWrite, %mountLeft%, c:\DFscript\config.ini, Hotkeys, mountLeft
- IniWrite, %mountRight%, c:\DFscript\config.ini, Hotkeys, mountRight
- IniWrite, %autoFire%, c:\DFscript\config.ini, Togglekeys, autoFire
- IniWrite, %instaCast%, c:\DFscript\config.ini, Togglekeys, instaCast
- Gui, Destroy
Advertisement
Add Comment
Please, Sign In to add comment