PDA

View Full Version : AutoHotKey HELP!!!!! Sorry about the post in the hardware



Anonymous
09-25-2007, 02:18 AM
I'm having an issue getting my characters to move together, either my main character moves the opposite way i tell him to (through the w,a,s,d keys) or the other character doesn't move at all, here's my script:

WinGet, wowid, List, World of Warcraft

WinGet, wowid, List, World of Warcraft

~1::
KeyWait 1
IfWinActive, World of Warcraft
{
ControlSend,, 1, ahk_id %wowid1%
ControlSend,, 1, ahk_id %wowid2%
Return
}

~2::
KeyWait 2
IfWinActive, World of Warcraft
{
ControlSend,, 2, ahk_id %wowid1%
ControlSend,, 2, ahk_id %wowid2%
Return
}

~3::
KeyWait 3
IfWinActive, World of Warcraft
{
ControlSend,, 3, ahk_id %wowid1%
ControlSend,, 3, ahk_id %wowid2%
Return
}

~4::
KeyWait 4
IfWinActive, World of Warcraft
{
ControlSend,, 4, ahk_id %wowid1%
ControlSend,, 4, ahk_id %wowid2%
Return
}

~5::
KeyWait 5
IfWinActive, World of Warcraft
{
ControlSend,, 5, ahk_id %wowid1%
ControlSend,, 5, ahk_id %wowid2%
Return
}

~6::
KeyWait 6
IfWinActive, World of Warcraft
{
ControlSend,, 6, ahk_id %wowid1%
ControlSend,, 6, ahk_id %wowid2%
Return
}

~7::
KeyWait 7
IfWinActive, World of Warcraft
{
ControlSend,, 8, ahk_id %wowid1%
ControlSend,, 8, ahk_id %wowid2%
Return
}

~8::
KeyWait 8
IfWinActive, World of Warcraft
{
ControlSend,, 8, ahk_id %wowid1%
ControlSend,, 8, ahk_id %wowid2%
Return
}

~9::
KeyWait 9
IfWinActive, World of Warcraft
{
ControlSend,, 9, ahk_id %wowid1%
ControlSend,, 9, ahk_id %wowid2%
Return
}

~0::
KeyWait 0
IfWinActive, World of Warcraft
{
ControlSend,, 0, ahk_id %wowid1%
ControlSend,, 0, ahk_id %wowid2%
Return
}

~-::
KeyWait -
IfWinActive, World of Warcraft
{
ControlSend,, -, ahk_id %wowid1%
ControlSend,, -, ahk_id %wowid2%
Return
}

~=::
KeyWait =
IfWinActive, World of Warcraft
{
ControlSend,, =, ahk_id %wowid1%
ControlSend,, =, ahk_id %wowid2%
Return
}

~w::
KeyWait w
IfWinActive, World of Warcraft
{
ControlSend,, {w Down}, ahk_id %wowid1%
ControlSend,, {w Down}, ahk_id %wowid2%
Return
}

~a::
KeyWait a
IfWinActive, World of Warcraft
{
ControlSend,, {a Down}, ahk_id %wowid1%
ControlSend,, {a Down}, ahk_id %wowid2%
Return
}

~s::
KeyWait s
IfWinActive, World of Warcraft
{
ControlSend,, {s Down}, ahk_id %wowid1%
ControlSend,, {s Down}, ahk_id %wowid2%
Return
}

~d::
KeyWait d
IfWinActive, World of Warcraft
{
ControlSend,, {d Down}, ahk_id %wowid1%
ControlSend,, {d Down}, ahk_id %wowid2%
Return
}

~w Up::
KeyWait w
IfWinActive, World of Warcraft
{
ControlSend,, {w Up}, ahk_id %wowid1%
ControlSend,, {w Up}, ahk_id %wowid2%
Return
}

~a Up::
KeyWait a
IfWinActive, World of Warcraft
{
ControlSend,, {a Up}, ahk_id %wowid1%
ControlSend,, {a Up}, ahk_id %wowid2%
Return
}

~s Up::
KeyWait s
IfWinActive, World of Warcraft
{
ControlSend,, {s Up}, ahk_id %wowid1%
ControlSend,, {s Up}, ahk_id %wowid2%
Return
}

~d Up::
KeyWait d
IfWinActive, World of Warcraft
{
ControlSend,, {d Up}, ahk_id %wowid1%
ControlSend,, {d Up}, ahk_id %wowid2%
Return
}

Just curious what I'm doing wrong

Djarid
09-25-2007, 09:30 AM
ok for a start you are passing through the key press and then also sending it to your main, this will result in 2x w... try it in a chat box... v annoying


the ~ means pass the button press through to your active window and also do anything in the procedure

I also found that keywait was not as good as testing for the key up condition

try something like...

[code:1]
w::
ControlSend,, {w Down}, ahk_id %wowid1%
ControlSend,, {w Down}, ahk_id %wowid2%
Return

w Up::
ControlSend,, {w Up}, ahk_id %wowid1%
ControlSend,, {w Up}, ahk_id %wowid2%
Return
[/code:1]

Another thing... the line

[code:1]#IfWinActive, World of Warcraft[/code:1]

can be specified once in the script... everything below this line is considered to be governed by it

I put all my general commands above this line and all the WOW specifics below it. it just makes the script easier to read.

anyway, I hope this helps