Jump to content

Controlling Mouse Not Working Properly


Recommended Posts

Id like to automate some simple tasks for a DirectX9c game Battlefield 2:

Right click for opening a context menu and left click for selecting something.

Looks like this:

http://img327.imageshack.us/my.php?image=menu3us.jpg

Unfortunately functions like MouseMove dont work because I cant select the desired coordinates.

Using something like MouseMove ( 500, 500, 10 ) gets the curser immediately out of the display instead of in the middle.

It seems that one pixel in the function has the effect of about 100 pixel mouse movement.

MouseMove ( 4, 4, 100 ) gets the curser about in the middle, MouseMove ( 5, 5, 100 ) moves the curser another 100 pixel down and right.

In Windows the macro works fine, but not ingame. I also tried to adjust the MouseSpeed in windows settings and ingame and used the Option "MouseCoordMode", all with no effect.

Link to comment
Share on other sites

First u need to know what resolution works the game, if is low resolution u have to check with 320, or 640 as max x pointer of mouse.

Try to put the windows resolution same as the game, to make a test.

then, u can try to modify the mousecoordmode and make tests.

MouseCoordMode Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

Edited by Libre

I love this Game :p----------------------Freeware Multilange support or Translate your scripts----------------------aNyBoDy KnOwS WhY A LiGhT iN My KeYbOaRd iS aLlWaIs BlInKiNg !?Who is "General Failure" and what is he doing in my hard disk !!!!!?

Link to comment
Share on other sites

Thanks for the fast reply!

I already set MouseCoordMode form 0 to 2, it has no effect at all. Guess cause the game is a fullscreen application.

The resolution is 1280 x 1024.

MouseMove ( 1, 1, 10 ) moves the mouse pointer near the top left corner of the display.

MouseMove ( 12, 7, 10 ) moves the mouse pointer near the bottom right corner of the display.

Thats the prob, I cant select precise coordinates this way.

Edited by Envelo
Link to comment
Share on other sites

This worked for me, ingame i believe should work also

Sleep(4000)

$pos = MouseGetPos()

MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])

Copy it into an au3 file and run it, open battlefield and place the mouse where you'd like to see the coords.. good luck

Link to comment
Share on other sites

thx Jasio

The funny thing is "MouseGetPos" gets me coords like x 5, y 5 although im pointing in the middle of a 1280 x 1024 screen.

These functions work well in windows, even in the start menu of the game.

But as soon I go ingame (directx9c graphics) they fail.

In the screenshot I included in my first post I can move my mouse just like normal, but cant work with these mouse functions.

Link to comment
Share on other sites

ITS CUZ THE GAME BLOCKS THE FREAKING HOOKS FROM AUTOIT AND ACTOOLS OR WHATEVER ELSE YOU USE, ONLY POSSIBLY DELPHI AND C OR C++ OR ANY OTHER MORE ADVANCED LANGUAGES WILL WORK FOR THE GAME, hahah capslock but by the way idk thats what it is for most games because its D3D so you cant get pixels and its got some game protector to block any hooking of the keyboard and mouse

Edited by thatsgreat2345
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...