Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; Metadata
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- /*
- Script:
- Version=1
- Name=FreeFog DotA 2 Self Cast Modifier
- Author=FreeFog
- Date=28/Jul/2013
- Purpose:
- Add a modifier key which targets the player's current selected unit.
- File:
- Name=FF_DotA2_SelfCast.ahk
- */
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; Notes
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- /*
- Hotkeys:
- Self Cast Modifier Key.
- Hide Cursor.
- *F10 Reload Script.
- Shift F10 Close Script.
- Measure Tool.
- User:
- Prerequisites:
- DotA 2.
- Text Editor.
- AutoHotkey:
- Variant=L
- Web=http://www.autohotkey.com/
- File Name=AutoHotkey_L_Install.exe
- VirusTotal:
- Results=4/46
- Date=29/Jul/2013
- Link=https://www.virustotal.com/en/file/aab0c5b9cadec99dcfe8e7cb141bf63c672015c85c5d19a1c1bdb5c80ebe1e63/analysis/1375141798/
- Setup:
- Starting in the Desktop run this script.
- Press the desired key to be used.
- Go to the taskbar (Next to the clock).
- Open the script's windows (Double Click).
- Menu Bar > View > Key history and script info (Ctrl K).
- Scroll down and locate the corresponding line.
- If the desired key is among English standard alphabet or keyboard modifiers
- Copy the name under the Column "Key" (tutSelfCast).
- Else
- Copy the vk and sc values to form the string=vkXXscYYY, ex=vkC0sc027 for ñ (tutSelfCast).
- Source=http://www.autohotkey.com/docs/KeyList.htm#SpecialKeys
- Exit the script (Right Click > Exit).
- Open the script on the Text Editor.
- Scroll to Mark: Measure Tool (Find=Mark: Measure Tool).
- Erase /* and */, note their placement.
- Save the edits (Ctrl S).
- Start the script (Double Click).
- Run DotA 2.
- Create a Practice with Bots Game.
- Center your mouse cursor in the Character Portrait and press F5.
- Copy the values from the pop-out window then close it (tutX, tutY).
- Close DotA 2 and the script.
- Back to the Text Editor.
- Scroll to Section: Main > Mark: Measure Tool (Find=Mark: Measure Tool).
- Add /* and */ as they were before (Ctrl Z).
- Scroll to Section: Config (Find=; Config).
- kKeySelfCast := "tutSelfCast"
- xkPortraitX := tutX
- xkPortraitY := tutY
- Scroll to Section: Main > Mark: Self Cast Key (Find=Mark: Self Cast Key).
- If the desired key performs is NOT limited to this script, i.e. performs
- another action such as key f writes f or is shared among scripts
- Replace *RShift:: with ~*tutSelfCast:: (Ctrl H).
- Explanation:
- Prefixing a hotkey with ~ will preserve its native function, i.e.
- the key adds the behavior defined on its hotkey to its own.
- Source=http://www.autohotkey.com/docs/Hotkeys.htm
- Else
- Replace *RShift:: with *tutSelfCast:: (Ctrl H).
- Save the edits (Ctrl S).
- Setup Optionals:
- Hide the Cursor while holding down:
- On the script uncomment and modify Section: Config:
- kKeyHideCursor := "Numpad9"
- On DotA 2 autoexec.cfg:
- // Toggle Cursor Visibility
- alias "ToggleCursorVisibility" "ToggleCursorVisibility_Hide"
- alias "ToggleCursorVisibility_Hide" "dota_hide_cursor 1;alias ToggleCursorVisibility ToggleCursorVisibility_Show"
- alias "ToggleCursorVisibility_Show" "dota_hide_cursor 0;alias ToggleCursorVisibility ToggleCursorVisibility_Hide"
- bind "KP_9" "ToggleCursorVisibility"
- Find out a DotA 2 key alias:
- Open DotA 2 and assign the key to Control Group 1.
- Go to config.cfg
- ...\Steam\steamapps\common\dota 2 beta\dota\cfg\
- Search for dota_control_group 1 and extract the key alias.
- Start this script from another:
- run H:\AHk_Scripts\Dota2\FF_DotA2_SelfCast.ahk
- Start this script and DotA 2:
- Create a file named:
- DotA2Ini.bat
- Open it with the Text Editor and place:
- @echo off
- rem Switch to drive H
- H:
- rem DotA 2 AutoHotkey Script
- cd "H:\AHk_Scripts\Dota2\"
- start FF_DotA2_SelfCast.ahk
- rem Steam Loaded DotA 2
- start steam://rungameid/570
- exit
- Edit to fit your setup.
- Find out DotA 2 Steam ID:
- Steam Library > Right Click DotA 2 > Create Desktop Shortcut.
- Open the shortcut's properties and extract the values.
- Save edits.
- Emergency Kill Switch:
- Section: Main
- Pressing Shift F10 will close the script.
- Pressing F10 alone or with any other key modifier will reload it.
- Measure Tool:
- Erase comments, using /* */ does not seam to work. You might need to manually refresh the script if u use /* */.
- Assign a free hotkey to trigger the script, i.e. not used by other Autohotkey Script.
- Windows Detection:
- On this script I use DotA'2 windows title, therefore events will be send to any windows whose name matches exactly the string "DOTA 2".
- Self:
- Uncomment the Measure Tool in the Main section to build boundaries.
- Emergency Hotkeys should be shared across scripts thru an include.
- "if !w" causes an error, it modifies w, use if !(w) or (!w) instead.
- */
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; Config
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- kKeySelfCast := "RShift"
- ; Manually mod "Mark: Self Cast Key".
- xkPortraitX := 373
- xkPortraitY := 795
- ; kKeyHideCursor := "Numpad9"
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; Ini
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- #NoEnv
- #SingleInstance Ignore
- SetBatchLines -1
- Process, Priority,, Realtime
- SetTitleMatchMode, 3
- #InstallKeybdHook
- #InstallMouseHook
- CoordMode Mouse, Screen
- SetMouseDelay -1
- SetKeyDelay -1
- BlockInput Mouse
- SendMode Input
- return ; Header End
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; Main
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- #IfWinActive DOTA 2
- ; Emergency Exit
- ~+F10::ExitApp
- ; Emergency Reset
- ~*F10::Reload
- ; Mark: Measure Tool
- /*
- ~*F5::
- MouseGetPos Sx, Sy
- MsgBox % "X:" Sx . " | " . "Y:" . Sy ; %
- Sx := "", Sy := ""
- return
- */
- ; Mark: Self Cast Key
- *RShift::
- if GetKeyState(kKeySelfCast, "P") {
- if (kKeyHideCursor) {
- SendInput {Blind}{%kKeyHideCursor%}
- Sleep 10
- }
- MouseGetPos x, y
- Xp := x
- Yp := y
- BlockInput MouseMove
- MouseMove xkPortraitX, xkPortraitY, 0
- }
- while GetKeyState(kKeySelfCast, "P")
- Sleep 10
- MouseMove Xp, Yp, 0
- BlockInput MouseMoveOff
- if (kKeyHideCursor) {
- SendInput {Blind}{%kKeyHideCursor%}
- Sleep 10
- }
- return
- #IfWinActive
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; ---------------------------------------------------------------------------------------------------------------------------------------------------
- ; --------------------------------------------------------------------------
- ; --------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement