Oxin8 Posted February 9, 2006 Share Posted February 9, 2006 (edited) This is a function I made when I found the Battlefield 1984 didn't use the desktop cursor, rather it had it's own. There's no easy way to explain this but I'm gonna try. _MouseMovePlus() uses the "mouse_event", a low level mouse simulator. What's that mean? It means that whatever you pass to it, the computer treats it as though it came from the mouse. MOST PEOPLE WILL NEVER NEED THIS. I'm not gonna lie. If you're not looking for this, you probably won't use it. If, on the other hand, you're trying to bot in a game but a supposedly simple MouseMove() has a result of about 63 times more than what you expected, you came to the right place.Here's the function:Func _MouseMovePlus($X, $Y,$absolute = 0) Local $MOUSEEVENTF_MOVE = 1 Local $MOUSEEVENTF_ABSOLUTE = 32768 DllCall("user32.dll", "none", "mouse_event", _ "long", $MOUSEEVENTF_MOVE + ($absolute*$MOUSEEVENTF_ABSOLUTE), _ "long", $X, _ "long", $Y, _ "long", 0, _ "long", 0) EndFuncIt takes an X and a Y and an option parameter. The $absolute parameter specifies when or not to use relative or absolute coords. Relative is the default. In relative mode, X and Y is the distance you want to move relative to the current mouse position. In absolute mode, X and Y are values from 0 to 65535 where (65535,65535) is the bottom right corner.To use this the same way as MouseMove(), this is what you'd do:_MouseMovePlus($X*(65535/@DesktopWidth), $Y*(65535/@DesktopHeight),1)Here is the MSDN of the function.Like I said, if you're not looking for this, you'll probably never use it. Feel free to ask questions about it if I didn't explain well enough.***NOTE: I just got a nice wake up IM with someone needing help using this. I haven't been active on these forums in over a year due to school and the like but if you need help, just hit me up on AIM: Oxin8 and I'll be more than willing to help as long as you have a valid question and know what you're talking about. None of that "Can you make me an Aimbot for <insert game>?" crap.*** Edited November 10, 2007 by Oxin8 ssamko 1 ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Oxin8 Posted February 9, 2006 Author Share Posted February 9, 2006 no, i want to be able to use the mouse_event coords relatively. I only added the multiplication in my example to show that it's not the same i guess. Battlefield 1942 uses the mouse_event coords so when you use autoit's MouseMove(), the cursor moves about 60 times as far as you want it to. Understand now? ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Sandro Alvares Posted February 9, 2006 Share Posted February 9, 2006 rect.right / rect.bottom / nspeed? Please send open code! I try here is i not obtain :\ Programmer PHP, ASP, CGI, Perl, Delphi, JScript, ......... :) Link to comment Share on other sites More sharing options...
GrungeRocker Posted February 10, 2006 Share Posted February 10, 2006 hmm nice script.. just what i was looking for! [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
ImNoHacker Posted May 21, 2006 Share Posted May 21, 2006 Nice code i was wondering if you could help me with something? How would you use the _MouseMovePlus() function to make the cursor move and click the left mouse button at a certain colour? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 21, 2006 Moderators Share Posted May 21, 2006 Nice code i was wondering if you could help me with something?How would you use the _MouseMovePlus() function to make the cursor move and click the left mouse button at a certain colour?Look at PixelSearch() in the help file. 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. Link to comment Share on other sites More sharing options...
Shevilie Posted May 14, 2007 Share Posted May 14, 2007 Trolling for UDF list Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
TomCat Posted September 28, 2007 Share Posted September 28, 2007 Hi can you help me. I try to use your Script to go to some fix points into a game but i dont understand how to define a fix point Here my testscript but i always get an Error when i start it Hope you can help me Func _MouseMovePlus($X, $Y,$absolute = 0) Local $MOUSEEVENTF_MOVE = 1 Local $MOUSEEVENTF_ABSOLUTE = 32768 DllCall("user32.dll", "none", "mouse_event", _ "long", $MOUSEEVENTF_MOVE + ($absolute*$MOUSEEVENTF_ABSOLUTE), _ "long", $X, _ "long", $Y, _ "long", 0, _ "long", 0) EndFunc HotKeySet("{PAUSE}", "start") HotKeySet("{ESC}", "quit") Func start() While 1 _MouseMovePlus($X*(65535/@DesktopWidth), $Y*(65535/@DesktopHeight),1) Sleep(10) WEnd EndFunc Func quit() Exit 0 EndFunc While 1 Sleep(10) WEnd Link to comment Share on other sites More sharing options...
jaenster Posted October 12, 2007 Share Posted October 12, 2007 ahh found one of the best udf's of autoit -jaenster Link to comment Share on other sites More sharing options...
brotwurst Posted October 18, 2007 Share Posted October 18, 2007 (edited) hey there! i built a little aimbot with this function... CODEHotKeySet("{f3}","stop") HotKeySet("{f2}","pause") HotKeySet("{f1}","start") while 1 sleep(1) WEnd func start() while 1 sleep(10) $pos=pixelsearch(@DesktopWidth/2-200,@DesktopHeight/2-200,@DesktopWidth/2+200,@DesktopHeight/2+200,8355968,10) if not @error then _MouseMovePlus($pos[0]*(65535/@DesktopWidth), $pos[1]*(65535/@DesktopHeight),1) EndIf WEnd EndFunc func pause() while 1 sleep(10) WEnd EndFunc func stop() Exit EndFunc Func _MouseMovePlus($X, $Y,$absolute = 0) Local $MOUSEEVENTF_MOVE = 1 Local $MOUSEEVENTF_ABSOLUTE = 32768 DllCall("user32.dll", "none", "mouse_event", _ "long", $MOUSEEVENTF_MOVE + ($absolute*$MOUSEEVENTF_ABSOLUTE), _ "long", $X, _ "long", $Y, _ "long", 0, _ "long", 0) EndFunc and i got a problem with it... if it finds the color the mouse moves anywhere on my screen but not to the (red) pixel any ideas? and sorry for my english...im as new to that as i am to autoit PS:nice work Oxin8! Edited October 18, 2007 by brotwurst Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 18, 2007 Share Posted October 18, 2007 I would just like to point out, that AutoIt uses the mouse_event in the actual code. All you are doing is calling something we already have. Link to comment Share on other sites More sharing options...
brotwurst Posted October 19, 2007 Share Posted October 19, 2007 aha...i tryed MouseMove() but:...MouseMove() has a result of about 63 times more than what you expected... Link to comment Share on other sites More sharing options...
lammaer Posted September 27, 2008 Share Posted September 27, 2008 Cheers for this, it works perfectly with the game freelancer. The only "problem" because mouse sensitivity can be configured within the game, moving 10 pixel from the code actually result 13 pixel move of the mouse cursor within the game. It is not a big problem anyway, I just need to divide all the coordinates by 1.3 and I get almost the exact result what I want. Thanks for this again! Link to comment Share on other sites More sharing options...
Giakomo1201 Posted July 11, 2013 Share Posted July 11, 2013 (edited) This post has been dead for years... but I'll try. I get an error on line 29 Error variable not declared, on line 29. -snip- Help? Edited July 11, 2013 by Jos Link to comment Share on other sites More sharing options...
lorenkinzel Posted July 11, 2013 Share Posted July 11, 2013 (edited) Don't really understand the use (or concept) of this one yet, but this DOES make it work: (necro-dude) -snip- Edited July 11, 2013 by Jos Link to comment Share on other sites More sharing options...
Giakomo1201 Posted July 11, 2013 Share Posted July 11, 2013 (edited) This one supposedly emulates another mouse level when MouseMove() doesn't works. This is for a game, freelancer. Just got into AutoIt3 Today, and realized the mistake myself, thanks. Now I have problems with the coordinates. Should I do this with the gaem at fullscreen, or run it at windowed mode. I am using the AutoITinfo tool in client mode, so the coordinates I get should work on fullscreen, right? Also, second issue, the game is taking the coordinates in RELAtive mouse position. here what I got now: (note desktop res=Game res) I use the infotool in that mode becuase it worked before, howeverm I don't know If I should use the coordmode on screen, or client. Suggestions? Remeber it is fullscreen, Although I would change it to Windowed mode if it becomes easier. -snip- Edited July 11, 2013 by Jos Link to comment Share on other sites More sharing options...
BrewManNH Posted July 11, 2013 Share Posted July 11, 2013 Please read the forum rules especially in regards to game automation help requests. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Recommended Posts