Log in

View Full Version : Movement with AHK



Yoshiman03
06-14-2009, 09:54 AM
I have absolutely no idea how to code the script so that when i hold w or up, both my toons move forward, everytime i try to move them, it send the key press to both Wow's but only does so for like a second so they like ministep forward, i suppose its some sort of coding that is like when w is pressed, hold until w up, but i don't know how to actually write that as i am new to this coding. Atm im using


;
; Wow Duel Account Helper Version: .02a
; Language: English
; Platform: AutoHotkey Script
; Author: Sorn
; NOTES: Written for the Duel-Boxing.com forums, Send PM or post in the Autohotkey thread for assistance or suggestions
;
; Script Function:
; Allows you to play two copies of WOW at the same time
;

;Tell user what is about to happen
SplashTextOn, 325, , Preparing to find your Main and Clone windows of WoW.
Sleep, 2000
SplasHtextoff

;Grab unique window ID's
WinGet, wowid, List, World of Warcraft

; Minimize All WOW windows
WinMinimize, ahk_id %wowid1%
WinMinimize, ahk_id %wowid2%

;Determine Main and Clone Windows
WinActivate, ahk_id %wowid1%

MsgBox, 4,, Is this your WOW Main window? (press Yes or No)
IfMsgBox Yes
idMain = %wowid1%
else
idMain = %wowid2%

If idMain = %wowid1%
{
idClone = %wowid2%
} else {
idClone = %wowid1%
}

;Activate All WOW windows
WinActivate, ahk_id %idClone%
WinActivate, ahk_id %idMain%


;*** Special Functions ***

#IfWinActive, World of Warcraft
; *** Makes wow2 follow Wow1 Player ***
^-::
ControlSend,,{- down}{- up}, ahk_id %idClone%
return

#IfWinActive, World of Warcraft
; *** Makes wow2 Assist Wow1 Player ***
^=::
ControlSend,,{= down}{= up}, ahk_id %idClone%
return

;--------------------------------------------------------------------------------

ClonesPush(strKeys)
{
global idMain
global idClone
IfWinNotActive, ahk_id %idMain%
ControlSend, , %strKeys%, ahk_id %idMain%
IfWinNotActive, ahk_id %idClone%
ControlSend, , %strKeys%, ahk_id %idClone%
}

; *** Jump ***
;~Space::ClonesPush("{Space down}")
;~Space Up::ClonesPush("{Space up}")

; *******************
; *** Hotbars 1-0 ***
; *******************
~-::ClonesPush("{- down}{- up}")
~1::ClonesPush("{= down}{= up}{1 down}{1 up}")
~2::ClonesPush("{= down}{= up}{2 down}{2 up}")
~3::ClonesPush("{= down}{= up}{3 down}{3 up}")
~4::ClonesPush("{= down}{= up}{4 down}{4 up}")
~5::ClonesPush("{= down}{= up}{5 down}{5 up}")
~6::ClonesPush("{= down}{= up}{6 down}{6 up}")
~7::ClonesPush("{= down}{= up}{7 down}{7 up}")
~8::ClonesPush("{= down}{= up}{8 down}{8 up}")
~9::ClonesPush("{= down}{= up}{9 down}{9 up}")
~0::ClonesPush("{= down}{= up}{0 down}{0 up}")
~g::ClonesPush("{= down}{= up}{g down}{g up}")
~F1::ClonesPush("{= down}{= up}{F1 down}{F1 up}")
~F2::ClonesPush("{= down}{= up}{F2 down}{F2 up}")
~F3::ClonesPush("{= down}{= up}{F3 down}{F3 up}")
~F4::ClonesPush("{= down}{= up}{F4 down}{F4 up}")
~F5::ClonesPush("{= down}{= up}{F5 down}{F5 up}")
~F6::ClonesPush("{= down}{= up}{F6 down}{F6 up}")
~F7::ClonesPush("{= down}{= up}{F7 down}{F7 up}")
~F8::ClonesPush("{= down}{= up}{F8 down}{F8 up}")
~F9::ClonesPush("{= down}{= up}{F9 down}{F9 up}")
~F10::ClonesPush("{= down}{= up}{F10 down}{F10 up}")
~F11::ClonesPush("{= down}{= up}{F11 down}{F11 up}")
~F12::ClonesPush("{= down}{= up}{F12 down}{F12 up}")

[REMOVED: Was just above coding plus Alt, Shift]
; *******************************
; *** Hotbars Numpad1-Numpad0 ***
; *******************************
~Numpad1::ClonesPush("{Ctrl down}{Alt down}{= down}{= up}{1 down}{1 up}{Ctrl up}{Alt Up}")
~Numpad2::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{2 down}{2 up}{Ctrl up}{Alt Up}")
~Numpad3::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{3 down}{3 up}{Ctrl up}{Alt Up}")
~Numpad4::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{4 down}{4 up}{Ctrl up}{Alt Up}")
~Numpad5::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{5 down}{5 up}{Ctrl up}{Alt Up}")
~Numpad6::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{6 down}{6 up}{Ctrl up}{Alt Up}")
~Numpad7::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{7 down}{7 up}{Ctrl up}{Alt Up}")
~Numpad8::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{8 down}{8 up}{Ctrl up}{Alt Up}")
~Numpad9::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{9 down}{9 up}{Ctrl up}{Alt Up}")
~Numpad0::ClonesPush("{Ctrl down}{Alt Down}{= down}{= up}{0 down}{0 up}{Ctrl up}{Alt Up}")

; **********************************
; *** Move clones (not reliable) ***
; **********************************
Up::ClonesPush("{Up down}")
Up Up::ClonesPush("{Up up}")
Down::ClonesPush("{Down down}")
Down Up::ClonesPush("{Down up}")
Left::ClonesPush("{Left down}")
Left Up::ClonesPush("{Left up}")
Right::ClonesPush("{Right down}")
Right Up::ClonesPush("{Right up}")

;************************************************* ***********************************************
;********************************** SETTINGS **********************************************
;************************************************* ***********************************************
;Some of the settings you'll need to change.
;
;Under "Key Bindings" of the main menu you'll find "MultiAction Bar Bindings"
;By default they have no key binding.
;Set "BottomLeft Action Button 1-12" to "Shift 1-="
;Set "BottomRight Action Button 1-12" to "Ctrl 1-="
;Set "Right Action Button 1-12" to "Alt 1-="
;Set "Right ActionBar 2 Button 1-12" to "Ctrl-Alt 1-=" (For use with Numpad 1-0)
;
;Under "Interface" of the main menu you'll find "ActionBars"
;Click to show "Bottom Left Bar," "Bottom Right Bar," "Right Bar," and "Right Bar 2."
;
;Under "Macros" of the main menu, create a few new macros.
;Here's where things get creative. If you've noticed, I haven't made any
;"ClonesPush" for the "=" as that is your targetting macro on each bar.
;Simply put who you want to target with the spells on said bar.
;For heal classes I suggest you make a /target self for a healing bar.
;The other bars are for things like: /assist, /target leader, and consumables.




So if yoou can tell me how i can write for w, or more importantly my turning keys would be so much help :D

Bot
06-14-2009, 10:14 AM
Up::ClonesPush("{Up down}")
Up Up::ClonesPush("{Up up}")
Down::ClonesPush("{Down down}")
Down Up::ClonesPush("{Down up}")
Left::ClonesPush("{Left down}")
Left Up::ClonesPush("{Left up}")
Right::ClonesPush("{Right down}")
Right Up::ClonesPush("{Right up}")

seems as though you just add this into there:


w::ClonesPush("{w down}")
w up::ClonesPush("{w up}")
s::ClonesPush("{s down}")
s Up::ClonesPush("{s up}")
a::ClonesPush("{a down}")
a Up::ClonesPush("{a up}")
d::ClonesPush("{d down}")
d Up::ClonesPush("{d up}")


BUT... why do you want to do this?
you should be using a follow macro.

also note that i only think that code is right. i dont use ahk and have not tested it. it just looks like itd be right to me :)