Oxin8 Posted February 3, 2006 Posted February 3, 2006 So I'm trying to move the mouse in Battlefield 1942 and it's moving a lot more than it should be. By using: $temp = MouseGetPos() MouseMove($temp[0] + 1, $temp[1]) It moves the cursor about 100 pixels to the right. I tried adding a decimal with no result(probably because the function simply doesn't support it). I think my only solution is to simulate mouse movement more directly. I also tried using a modified _MouseClickPlus that I called _MouseMovePlus and that didn't seem to do anything. Func _MouseMovePlus($Window, $X = "", $Y = "") Local $WM_MOUSEMOVE = 0x0200 Local $temp $temp = WinGetHandle( $Window ) if @error=1 then msgbox(0,"ERROR","Window Not Found") DllCall("user32.dll", "int", "SendMessage", _ "hwnd", $temp, _ "int", $WM_MOUSEMOVE, _ "int", 0, _ "long", _MakeLong($X, $Y)) EndFunc Any thoughts, ideas, or anything else would be highly appreciated. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
Valuater Posted February 3, 2006 Posted February 3, 2006 maybe ("MouseCoordMode", 0) look for Autoit Options in help 8)
Oxin8 Posted February 3, 2006 Author Posted February 3, 2006 maybe("MouseCoordMode", 0) look for Autoit Options in help8)It's been in there for awhile. So that's not it. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
PartyPooper Posted February 3, 2006 Posted February 3, 2006 I would hazard a guess and say that BF1942 doesn't use a hardware mouse so trying to emulate a mouse movement with AutoIt won't work.
flaxcrack Posted February 3, 2006 Posted February 3, 2006 It's been in there for awhile. So that's not it. I play a MMORP and I use AutoIT in the game. Here is the heading of my code: #include <GUIConstants.au3> Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",1) [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
Oxin8 Posted February 4, 2006 Author Posted February 4, 2006 I would hazard a guess and say that BF1942 doesn't use a hardware mouse so trying to emulate a mouse movement with AutoIt won't work.Well then, what do you think it uses? I'm not a newb so I can handle the dll calls and such if that's what I need. Could someone point me in the right direction whether it be how Battlefield gets the input or ways of detecting how it gets the input and maybe a possible idea to simulate it? ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
PartyPooper Posted February 4, 2006 Posted February 4, 2006 Not sure exactly what it uses but it's possibly a software mouse emulation routine that's part of the main BF1942 program. As to how to get around this, sorry but I have no idea.
cdkid Posted February 4, 2006 Posted February 4, 2006 (edited) i'd look at downloading 'WinSpecter spy'... it may help u --hope this helps ~cdkid Edited February 4, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Oxin8 Posted February 4, 2006 Author Posted February 4, 2006 I ended up figuring it out on my own and made a much lower level mouse movement function. The X and Y coords are relative although this could be changed in the dll call (check "mouse_event" out on MSDN). positive x moves right positive y moves down Func _MouseMovePlus($X = "", $Y = "") Local $MOUSEEVENTF_MOVE = 0x1 DllCall("user32.dll", "none", "mouse_event", _ "long", $MOUSEEVENTF_MOVE, _ "long", $X, _ "long", $Y, _ "long", 0, _ "long", 0) EndFunc maybe someone else will find a use for this. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
PartyPooper Posted February 4, 2006 Posted February 4, 2006 Would the MouseCoordMode function have any effect on the coords (rather than changing via DLL call)?
Oxin8 Posted February 4, 2006 Author Posted February 4, 2006 Would the MouseCoordMode function have any effect on the coords (rather than changing via DLL call)?Nope. The call doesn't have much if anything to do with autoit set options. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
PartyPooper Posted February 4, 2006 Posted February 4, 2006 Ah ok. Is your function now working correctly for BF1942 or is the mouse still moving a little erratically?
Oxin8 Posted February 4, 2006 Author Posted February 4, 2006 works like a charm. my function should be good for any game as it's really low level. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
PartyPooper Posted February 5, 2006 Posted February 5, 2006 So how are you calling it using other autoit funtions? Can you give an example?
Oxin8 Posted February 5, 2006 Author Posted February 5, 2006 well, it's all for a much larger script that i hope to put in scripts and scraps by the end of the night but the line of code i'm using it in is: If abs($input[7]) > 4000 Or abs($input[8])>4000 Then _MouseMovePlus($input[7]/3000,-1*($input[8]/3000)) where $input[7] and $input[8] are both variables from joystick input that range from -32768 to 32767. so the line of code basically moves the mouse corresponding to the joystick movement. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
Sandro Alvares Posted February 6, 2006 Posted February 6, 2006 Look a example:http://www.autoitscript.com/forum/index.php?showtopic=7112 Programmer PHP, ASP, CGI, Perl, Delphi, JScript, ......... :)
PartyPooper Posted February 7, 2006 Posted February 7, 2006 I don't think that would work for games that use mouse emulation. I'm still scratching my head as to how Oxin8 has got his joystick working in a game that uses mouse emulation by using a user32.dll call. My understanding (and correct me if I'm wrong here) is that the games that use mouse emulation don't use the screen coordinates at all so functions that require absolute X & Y coords like MouseMove will always fail. I believe they use the mouseball / optical 'clicks' and emulate the mouse movement based on that. This means you would require a program (or DLLCall) that is able to move the mouse based on 'clicks', not screen coords. I could be way off here, but that's how it seems to me.
Oxin8 Posted February 7, 2006 Author Posted February 7, 2006 For the DllCall I used, I only made it move relative instead of using coords. There's some flags that I could use to take screen coords and add click and make it more similar to MouseClick() if I wanted to. I don't really understand it completely but the call doesn't move the cursor. From my understanding, what it does is inject the movement into the input stream coming from the mouse itself. _MouseClickPlus() is actually very different from the function I made as it sends the mouse movement and click messages to a certain handle. PartyPooper: If you don't get it still you can always PM me. Or if you have AIM my screenname is Oxin8. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus
Moderators SmOke_N Posted February 7, 2006 Moderators Posted February 7, 2006 For the DllCall I used, I only made it move relative instead of using coords. There's some flags that I could use to take screen coords and add click and make it more similar to MouseClick() if I wanted to. I don't really understand it completely but the call doesn't move the cursor. From my understanding, what it does is inject the movement into the input stream coming from the mouse itself. _MouseClickPlus() is actually very different from the function I made as it sends the mouse movement and click messages to a certain handle.PartyPooper: If you don't get it still you can always PM me. Or if you have AIM my screenname is Oxin8.Take a look at larry's ClickInControl() UDF... : http://www.autoitscript.com/forum/index.ph...indpost&p=37526No mouse movement. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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