WASD to client

05/23/2009 05:13 chompy2#1
Code:
Func keydown($bvkCode)
    DllCall('user32.dll', 'int', 'keybd_event', 'byte', $bvkCode, 'byte', 0, 'uint', 0, 'ptr', 0)
EndFunc  ;==>keydown
Func keyup($bvkCode)
    DllCall('user32.dll', 'int', 'keybd_event', 'byte', $bvkCode, 'byte', 0, 'uint', 2, 'ptr', 0)
EndFunc  ;==>keyup
	
Func SendKey($KEY,$MSEC)
   keydown('0x' & hex(Asc($KEY), 2))
   sleep($MSEC)
   keyup('0x' & hex(Asc($KEY), 2))
This works if the game has focus. You would have to movce the camera to move to the right spot using keys though. Anyone got a good way to do that?
05/24/2009 21:29 plixbugmenot#2
hmmyeah. I have a better way.

c/c++ funtion:

Code:
void SendKey(WPARAM key)
{
	PostMessage(m_hwnd,WM_KEYDOWN,key,0);
	Sleep(100); 
	PostMessage(m_hwnd,WM_KEYUP,key,0);
}
doesn't need focus.

I have no idea what you are actually trying to do though
05/25/2009 06:40 chompy2#3
I realize you know a hell of a lot more than I do about this stuff... but try sending movement keys using your function. It won't work unless your client isn't the same as mine. What I posted will work. keybd_event is the updated function for sendkeystate.

I'm sure there are better ways to do it in memory but I thought this might help some people.