blckpythn Posted May 4, 2010 Share Posted May 4, 2010 (edited) Alright, so I'm having some trouble getting the following script to work within a game(single-player). HotKeySet("{F4}", "Pixelchecker") HotKeySet("{F5}", "On_Exit") While 1 Sleep(10) WEnd Func Pixelchecker() $pixelcheck = PixelChecksum(715, 455, 725, 445, Default, "[ACTIVE]") ConsoleWrite("Entering waiting loop" & @CRLF) While $pixelcheck = PixelChecksum(715, 455, 725, 445, Default, "[ACTIVE]") Sleep(25) WEnd MouseClick("primary", 720, 450, 1, 0) ConsoleWrite("Clicked" & @CRLF) EndFunc ;==>Pixelchecker Func On_Exit() Exit EndFunc ;==>On_Exit Would this be due to the game stealing the inputs from the script or what? Edited May 4, 2010 by blckpythn Link to comment Share on other sites More sharing options...
Neno Posted May 4, 2010 Share Posted May 4, 2010 Can you please tell exactly what it is you're trying to accomplish... within this singleplayer game? Link to comment Share on other sites More sharing options...
blckpythn Posted May 4, 2010 Author Share Posted May 4, 2010 I'm trying to Snipe someone when they walk across my crosshairs. Difficult level Link to comment Share on other sites More sharing options...
Neno Posted May 4, 2010 Share Posted May 4, 2010 I'm trying to Snipe someone when they walk across my crosshairs. Difficult level Ah, k. That's easy. I don't know why you're doing a pixelchecksum though, why not a pixelsearch? Also, you're using static definitions for your checksum, even if you just wanted the gun to fire. Here's a hand: HotKeySet("{F4}", "Pixelchecker") HotKeySet("{F5}", "On_Exit") While 1 Sleep(10) WEnd Func Pixelchecker() While 1 $pos = MouseGetPos () $pixelcheck = PixelChecksum($pos[0] - 5, $pos[1] - 5, $pos[0] + 5, $pos[1] + 5, Default, "[ACTIVE]") Sleep(25) If $pixelcheck <> 0 Then ExitLoop WEnd MouseClick("Left") EndFunc ;==>Pixelchecker Func On_Exit() Exit EndFunc ;==>On_Exit Now it will check 5 pixels in every direction directly over your mouse. Link to comment Share on other sites More sharing options...
blckpythn Posted May 4, 2010 Author Share Posted May 4, 2010 (edited) The reason why it is in absolute values(middle of my screen)is because the game is fullscreen and takes mouse control. But it still doesn't seem to want to work. Also your script doesn't seem to check the checksum for changes, only whether or not it is zero. And the default mouse movement is too slow that's why I have MouseClick("primary", 720, 450, 1, 0) Edited May 4, 2010 by blckpythn Link to comment Share on other sites More sharing options...
Neno Posted May 4, 2010 Share Posted May 4, 2010 and your script doesn't seem to check the checksum for changes, only whether or not it is zero.If $pixelcheck <> 0 is checking for changes. <> is Not Equal. Failure of a checksum returns zero (0)I kind of also thought you were playing a flash game.... Full screen FPS's screw with mouse coords, and any kind of reliable coordinate mode is sort of unsupported in directx or opengl. Link to comment Share on other sites More sharing options...
blckpythn Posted May 4, 2010 Author Share Posted May 4, 2010 Ok its not checking for changes, its only checking whether or not it was capable of making a checksum. Link to comment Share on other sites More sharing options...
Neno Posted May 4, 2010 Share Posted May 4, 2010 (edited) Ok. I see what you're saying. Apologies, I don't ever use pixelchecksum. Basically you'll need to have to have to the checksum of what you're... well.. checking for to compare it with. Func Pixelchecker() $pos = MouseGetPos () while 1 While $pixelcheck = PixelChecksum($pos[0] - 5, $pos[1] - 5, $pos[0] + 5, $pos[1] + 5, Default, "[ACTIVE]") Sleep(25) WEnd If $pixelcheck >= *your variable?* Then MouseClick("Left") ExitLoop EndIf WEnd EndFunc ;==>Pixelchecker Edited May 4, 2010 by Neno Link to comment Share on other sites More sharing options...
blckpythn Posted May 4, 2010 Author Share Posted May 4, 2010 No, the original checksum in my script is fine. That's not the issue. The issue is that it won't work with a fullscreen program for some reason. Link to comment Share on other sites More sharing options...
Neno Posted May 4, 2010 Share Posted May 4, 2010 No, the original checksum in my script is fine. That's not the issue. The issue is that it won't work with a fullscreen program for some reason.That's because the game designer is probably blocking pseudo key-clicks, which, coincidentally is probably a red flag not to do what you're trying to do. Link to comment Share on other sites More sharing options...
JohnOne Posted May 4, 2010 Share Posted May 4, 2010 Your checksum will always be the same because you are not even giving it a proper rectangle. Infact nothing much you are saying makes much sense at all, "Its checking if its capable of checking" etc. What is the game, and what are you really trying to do ? You might not get help if you tell the truth but you are wasting everybodies time with otherwise. Also why try to use a window handle in full screen mode, surely you want absolute coordinates. AutoIt Absolute Beginners  Require a serial  Pause Script  Video Tutorials by Morthawt  ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
blckpythn Posted May 4, 2010 Author Share Posted May 4, 2010 That's because the game designer is probably blocking pseudo key-clicks, which, coincidentally is probably a red flag not to do what you're trying to do.It doesn't break the ToS, its an open source game.Your checksum will always be the same because you are not even giving it a proper rectangle.Infact nothing much you are saying makes much sense at all, "Its checking if its capable of checking" etc.What is the game, and what are you really trying to do ?You might not get help if you tell the truth but you are wasting everybodies time with otherwise. Also why try to use a window handle in full screen mode, surely you want absolute coordinates.It is a proper rectangle, unless you can prove otherwise. Its checking whether it retrieves a checksum or fails. I'm trying pretty much any parameter to see if there is a difference. Link to comment Share on other sites More sharing options...
Neno Posted May 4, 2010 Share Posted May 4, 2010 It doesn't break the ToS, its an open source game.What game?-------------Also, I can tell you right now that in a FPS your script will always fail to do what you want. You really can't use absolute coords when the mouse is locked. Link to comment Share on other sites More sharing options...
JohnOne Posted May 4, 2010 Share Posted May 4, 2010 Because the top of your rectangle is in a lower physical position than the bottom of it. AutoIt Absolute Beginners  Require a serial  Pause Script  Video Tutorials by Morthawt  ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
blckpythn Posted May 4, 2010 Author Share Posted May 4, 2010 What game?-------------Also, I can tell you right now that in a FPS your script will always fail to do what you want. You really can't use absolute coords when the mouse is locked.http://www.alientrap.org/nexuiz/ Link to comment Share on other sites More sharing options...
czardas Posted May 4, 2010 Share Posted May 4, 2010 Telling someone how to automate a single player game is not much different from telling everyone, who reads this forum, how to automate a multiplayer game. I suggest you avoid asking questions like this. operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
blckpythn Posted May 4, 2010 Author Share Posted May 4, 2010 Telling someone how to automate a single player game is not much different from telling everyone, who reads this forum, how to automate a multiplayer game. I suggest you avoid asking questions like this.Regardless of whether or not its for a game, what would stop it from continuing Link to comment Share on other sites More sharing options...
czardas Posted May 4, 2010 Share Posted May 4, 2010 Regardless of whether or not its for a game, what would stop it from continuingI only mentioned it for your benefit. The developers of AutoIt have made their position clear on the automation of games for a very simple reason. It gives AutoIt bad publicity, which also has other negative effects. While your intentions may be genuine, I am sure you will appreciate that others may wish to exploit AutoIt for uses other than those which it was intended. Therefore it is within everyones best interest to avoid discussing certain subjects: this being one of them. operator64Â Â ArrayWorkshop Link to comment Share on other sites More sharing options...
Neno Posted May 4, 2010 Share Posted May 4, 2010 (edited) Regardless of whether or not its for a game, what would stop it from continuingDidn't we both answer your question?edit:Let me be more frank. Most "fullscreen" games as you like to call it, and FPS's lock the mouse -- usually it's in the center, but some game devs love screwing with cheaters, and sometimes lock it off the screen or somewhere completely random.Unless I know *what* it is you're trying to do, exactly, it's very unlikely I can help you. Edited May 4, 2010 by Neno Link to comment Share on other sites More sharing options...
jebus495 Posted May 4, 2010 Share Posted May 4, 2010 What exactly do you want your script to do? What pixelchecksum does is essentially add of the value of every pixel in a given rectangle. You normally compare the sum of pixels in the same area to determine if something has changed. It will return with a change even if only 1 pixel changes. Link to comment Share on other sites More sharing options...
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