Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;;;;;;;;;;;;;;;;; Includes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- #SingleInstance force
- #InstallKeybdHook
- #InstallMouseHook
- #NoEnv
- #If !isMouseShown()
- if not A_IsAdmin
- {
- Run *RunAs "%A_ScriptFullPath%"
- ExitApp
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;; Keybinds ;;;;;;;;;;;;;;;;;;;;;;;;;;
- 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
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;; XML Parser ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- FileRead, configVar, %fileloc%
- doc := loadXML(configVar)
- preset0 := doc.selectSingleNode("/SFConfig/InputBindings0/@Value").text
- preset1 := doc.selectSingleNode("/SFConfig/InputBindings1/@Value").text
- preset2 := doc.selectSingleNode("/SFConfig/InputBindings2/@Value").text
- presetSlot := doc.selectSingleNode("/SFConfig/InputPresetSlot/@Value").text
- if(presetSlot = "0")
- {
- keyLoc := preset0
- }else if(presetSlot = "1")
- {
- keyLoc := preset1
- }else if(presetSlot = "2")
- {
- keyLoc := preset2
- }
- DisplayNode(nodes, indent=0)
- {
- for node in nodes
- {
- if node.nodeName != "#text"
- text .= spaces(indent) node.nodeName ": " node.nodeValue "`n"
- else
- text .= spaces(indent) node.nodeValue "`n"
- if node.hasChildNodes
- text .= DisplayNode(node.childNodes, indent+2)
- }
- return text
- }
- spaces(n)
- {
- Loop, %n%
- t .= " "
- return t
- }
- loadXML(ByRef data)
- {
- o := ComObjCreate("MSXML2.DOMDocument.6.0")
- o.async := false
- o.loadXML(data)
- return o
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 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"
- ;;;;;;;;;;;;;;;;;;;; Functions ;;;;;;;;;;;;;;;;;;;;;;;
- GetKey(bind, fileLoc)
- {
- StringGetPos, startPos, fileLoc, %bind%
- StringTrimLeft, fileloc, fileLoc, startPos
- StringReplace, fileLoc, fileLoc, `,, +, all
- StringReplace, fileLoc, fileLoc, `n, +, all
- Loop, Parse, fileLoc, +, `,
- {
- var%A_Index% := A_LoopField
- }
- ;MsgBox % var1
- FileRead, keylist, keylist.txt
- if not ErrorLevel
- {
- Loop, Parse, keylist, `~, %A_Space%
- if RegExMatch(A_LoopField,"^(" var2 ")=(.*)$",found)
- key1 := found2
- Loop, Parse, keylist, `~, %A_Space%
- if RegExMatch(A_LoopField,"^(" var3 ")=(.*)$",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
- }
- say(msg)
- {
- global ttsEnabled
- if(ttsEnabled == "true")
- {
- global SAPI
- SAPI.speak(msg,1)
- }
- }
- getIni(config, section, key)
- {
- IniRead value, %config%, %section%, %key%
- return value
- }
- global leftAction := GetKey(actionL, keyLoc)
- global rightAction := GetKey(actionR, keyLoc)
- spawnMount := GetKey(quick5, keyLoc)
- 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%, keyLoc)
- Hotkey, ~%variables%, left1
- }
- loop, 8
- {
- variables := GetKey(Rradial%A_Index%, keyLoc)
- Hotkey, ~%variables%, right1
- }
- ;;;;;;;;;;;;;;;;;;;;; Set Message ;;;;;;;;;;;;;;;;;;;;;;;;
- ;keyMsg = Set.
- ;say(keyMsg)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ^+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
Advertisement
Add Comment
Please, Sign In to add comment