creeping Posted June 5, 2007 Posted June 5, 2007 (edited) The following code works if I run it when the desktop is visible, it does not work when my game is visible. The game can be run in full screen mode or windowed mode. I have tried running the script in both modes. The hotkey function does not seemed to called at all. Are there any reasons why running a game would cause the script to fail? Thanks. HotKeySet('2', 'pistol') While 1 Sleep(1) WEnd Func pistol() HotKeySet('2') Send('2') For $i = 1 To 10 Step 1 MouseClick('left') _MouseMoveRelative(0, 5) Sleep(100) Next HotKeySet('2', 'pistol') EndFunc Func _MouseMoveRelative($iX, $iY) Local Const $MOUSEEVENTF_MOVE = 0x01 DllCall('user32.dll', 'int', 'mouse_event', 'int', $MOUSEEVENTF_MOVE, 'int', $iX, 'int', $iY, 'int', 0, 'int', 0) EndFunc Edited June 5, 2007 by creeping
Somerset Posted June 5, 2007 Posted June 5, 2007 SendKeyDelay-Alters the the length of the brief pause in between sent keystrokes. Time in milliseconds to pause (default=5). Sometimes a value of 0 does not work; use 1 instead. SendKeyDownDelay-Alters the length of time a key is held down before being released during a keystroke. For applications that take a while to register keypresses (and many games) you may need to raise this value from the default. Time in milliseconds to pause (default=5). that is taken from the help file up the sendkeydelay and or the sendkeydowndelay in crease their time it should help.
PsaltyDS Posted June 5, 2007 Posted June 5, 2007 The hotkey function does not seemed to called at all. Are there any reasons why running a game would cause the script to fail?Many games block simulated inputs and the interception of key/mouse actions to prevent bots. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
creeping Posted June 5, 2007 Author Posted June 5, 2007 Many games block simulated inputs and the interception of key/mouse actions to prevent bots. Ok guess that must be the problem, I thought autoit basically did generate true keyboard and mouse commands. But what do I know the workings of autoit internally. Thanks.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now