Jump to content

Script not working while I run a program


Recommended Posts

Hello there... I'm new to AutoIt language, in fact, found out about it some hours ago and I'm rather amazed at how powerful it is! Even though I'm new to scripting in general, I'm not new to programming :(

Anyway...

My brother asked me to write a simple bot for a game he plays, and so I did.. The script works wonderful when I run it on Windows (got XP, if anything) as I tested it with the notepad open and it does exactly what it has to do.. when pressing F5 the mouse should move to certain coords and do some stuff like sending some strings and moving to new coords again, until the user presses F7... as i said, all that works fine with the notepad on the background or actually, any "simple" program on the background..

... so here's the actual problem:

When I run the script, and then run the game, after I'm inside the game if I press F5, the tasks that are supposed to be done are done in the background, but not in the game.. At the game, the mouse isn't even moving.. lol..

So... I was wondering.. what am I missing? Where am I screwing it up? :S

Thanks a lot in advance! >_<

Link to comment
Share on other sites

Hi,

I'm not really a botting fan,

If your using HotKeySet() then you'll probably find the game is actually ignoring the the hotkey so your script isn't firing..

Instead of using HotKeySet() you can use _IsPressed() or _WinAPI_SetWindowsHookEx() and _WinAPI_CallNextHookEx()

The _WinAPI_SetWindowsHookEx() and _WinAPI_CallNextHookEx() method of capturing a certain key or keys that are pressed seems to work no matter what has focus on screen and I can have the script running for days on end without problems.

I find the _IsPressed() will eventually crash the script if you use it in a loop and run it for long hours trying to get a keypress. (Don't get me wrong as _IsPressed() function does work well, but calling it constantly is an ugly way to do things imho)

Cheers

Link to comment
Share on other sites

Hi,

I'm not really a botting fan,

If your using HotKeySet() then you'll probably find the game is actually ignoring the the hotkey so your script isn't firing..

Instead of using HotKeySet() you can use _IsPressed() or _WinAPI_SetWindowsHookEx() and _WinAPI_CallNextHookEx()

The _WinAPI_SetWindowsHookEx() and _WinAPI_CallNextHookEx() method of capturing a certain key or keys that are pressed seems to work no matter what has focus on screen and I can have the script running for days on end without problems.

I find the _IsPressed() will eventually crash the script if you use it in a loop and run it for long hours trying to get a keypress. (Don't get me wrong as _IsPressed() function does work well, but calling it constantly is an ugly way to do things imho)

Cheers

Actually that's not the problem I got.. when I'm at the game, and press the trigger key, the mouse moves to the coords it is supposed to move, and do the stuff it is supposed to do.. just not in the game, but on the desktop (I find out cause when I minimize the game I see the bot running on the desktop).. so that's the odd thing :S

Oh and.. I did use the IsPressed() function, not the HotKey one...

Anyway, thanks for your kind reply >_<

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...