EndersGame Posted October 16, 2008 Share Posted October 16, 2008 (edited) Skip to the paragraph(ish) before my code if you don't want a story.Basically doing this for practice so I can get a hang of things. I've only started programming(as in never before) like 3 weeks ago, etc. So... noob questions ahead. Not sure if talking about making scripts for games is against forum policy (some forums are weird like that :/ and I couldn't find a forum rules thread) if it is ill edit.Here's the game http://www.digyourowngrave.com/pel/Basically the background of the game is black and I want it to move when something which isn't black passes over. So I do a pixel search for black then if the computer doesn't find black it returns @error = 1 which is my if statement, all this in a while loop so it does it continuously (confirm please).And that's the gist of my script, the middle one has an extra pixel search to see on which side my paddle is.So my problems are1. It doesn't work (of course ), all it does is send left left and right right really fast and I don't understand why since the background IS black. (the screen is in the same position as when i froze the window thing for the coordinates)2. Also how do I know how much shade difference I want to put if i want it to search between grey and white.3. How do I set it up if i want the script to only start when I press a hotkey I tried to make a hotkeyset with the whole script as hotkeyed but it would just start and exit the script instantly.HotkeySet("p", "pause") AutoItSetOption("TrayIconDebug", 1) While (True) ;left side PixelSearch(240,760,255,750,0x000000) if (@error=1)Then Send("{left}{left}") EndIf ;middle PixelSearch(435, 735, 455, 725, 0x000000) if (@error=1) Then PixelSearch(257,790,257,790, 0x888888) if(@error=0) Then Send("{right}") Else Send("{left}") EndIf EndIf ;right side PixelSearch(635,770,650,760, 0x000000) if (@error = 1) Then Send("{right}{right}") EndIf Wend Func pause() Send("{esc}") EndFunc Edited October 16, 2008 by EndersGame Link to comment Share on other sites More sharing options...
Minikori Posted October 16, 2008 Share Posted October 16, 2008 3. How do I set it up if i want the script to only start when I press a hotkey I tried to make a hotkeyset with the whole script as hotkeyed but it would just start and stop the scrip instantly.expandcollapse popupHotkeySet("p", "pause") HotKeySet("g", "Go") AutoItSetOption("TrayIconDebug", 1) While 1 Sleep(100) WEnd Func Go() While (True) ;left side PixelSearch(240,760,255,750,0x000000) if (@error=1)Then Send("{left}{left}") EndIf ;middle PixelSearch(435, 735, 455, 725, 0x000000) if (@error=1) Then PixelSearch(257,790,257,790, 0x888888) if(@error=0) Then Send("{right}") Else Send("{left}") EndIf EndIf ;right side PixelSearch(635,770,650,760, 0x000000) if (@error = 1) Then Send("{right}{right}") EndIf Wend EndFunc Func pause() Send("{esc}") EndFunc For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
herewasplato Posted October 16, 2008 Share Posted October 16, 2008 ... Not sure if talking about making scripts for games is against forum policy ...It is not against any forum policy per se. Some members will help you with games other members consider scripting a game cheating. As for the game that you linked to. As a general rule - if the "AutoIt Window Info" tool cannot "see" the colored objects - then your script won't either.Open that tool, select the tab named mouse, then click on the windows of interest. Move the mouse to the place where the colored objects will be - nothing changes :-(I don't know why some flash objects can be "seen" and others can't... but then I don't know a lot of things :-) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Diko Posted December 16, 2008 Share Posted December 16, 2008 (edited) Hi guys, this is going to be my first script. So it is a try to make a very small bot which will help me get the jumping rope contest on Facebook's Pet Society contest. Sooo the idea is the following: There is my "animal" ;$me that is jumping on that rope. So when the rope from black turns red (0x990000) the bot is suppoed to click the left mouse button somewhere on my animal's colour (0x6c5EA7). Here is my script based on the previous script and of course I am doing it tottaly wrong so it is not working. PLS also note that I have narrowed it down to specific coordinates, so the PixelSearch would work faster. PLS give some advice. Thanks in advance. Following is the code: HotkeySet("q", "quit") HotKeySet("g", "Go") AutoItSetOption("TrayIconDebug", 1) While 1 Sleep(100) WEnd Func Go() ToolTip("BOT Active", 0, 0) Sleep(2000); Sleep to give tooltip time to display While (True) PixelSearch(280 360 440 550,0x990000);red rope if (@error=1)Then Sleep(10) Else $me = PixelSearch(280 360 440 550,0x6c5EA7);me MouseClick("left", $me) EndIf Wend EndFunc Func quit () ToolTip("Quitting BOT", 0, 0) Sleep(2000); Sleep to give tooltip time to display EndFunc $me = PixelSearch(280 360 440 550,0x6c5EA7) ;me MouseClick("left", $me) This part sucks... PLS advice ;-) Edited December 16, 2008 by Diko Link to comment Share on other sites More sharing options...
Diko Posted January 1, 2009 Share Posted January 1, 2009 I would really appreciate some help here Thanks in advance. Link to comment Share on other sites More sharing options...
Aceguy Posted January 1, 2009 Share Posted January 1, 2009 just a quick observation PixelSearch(280 360 440 550,0x990000);red rope should be PixelSearch(280,360,440,550,0x990000);red rope and the same with the other one. [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Diko Posted January 13, 2009 Share Posted January 13, 2009 (edited) Just wanted to thanks for the tip. This additionally to the small change whereMouseClick("primary", $me[0],$me[1],1,0)is now.That way I managed to solve it and... I did it ;-)HotkeySet("{F10}", "quit") HotKeySet("{F9}", "Go") AutoItSetOption("TrayIconDebug", 1) While 1 Sleep(100) WEnd Func Go() ToolTip("BOT Active", 0, 0) Sleep(2000); Sleep to give tooltip time to display While (True) PixelSearch(700,370,1100,520,0x990000);red rope if (@error=1)Then Sleep(10) Else $me = PixelSearch(700,370,1100,520,0xC12727);me MouseClick("primary", $me[0],$me[1],1,0) EndIf Wend EndFunc Func quit () ToolTip("Quitting BOT", 0, 0) Sleep(2000); Sleep to give tooltip time to display EndFuncNow I am trying something else:I have a rectangular (absolute position) where I am waiting for an object with specific color (absolute number) to appear so I can click on it.This is much easier but I get stuck on the folloing part:HotkeySet("{F10}", "quit") HotKeySet("{F9}", "Go") AutoItSetOption("TrayIconDebug", 1) While 1 Sleep(100) WEnd Func Go() ToolTip("BOT Active", 0, 0) Sleep(2000); Sleep to give tooltip time to display While (True) $subject = PixelSearch(800,240,900,520,0x990000);subject if (@error=1)Then Sleep(10) Else $subject = PixelSearch(800,240,900,520,0x990000);subject MouseClick("primary", $subject[0],$subject[1],1,0) EndIf Wend EndFunc Func quit () ToolTip("Quitting BOT", 0, 0) Sleep(2000); Sleep to give tooltip time to display EndFuncIt says that I am in mistake on the second Sleep(10)PLS Help :-) I assume that I did it much more complicated than it actuallu is :-) Edited January 13, 2009 by Diko Link to comment Share on other sites More sharing options...
jaberwacky Posted January 13, 2009 Share Posted January 13, 2009 HotkeySet("p", "pause") AutoItSetOption("TrayIconDebug", 1) While (True) ;left side PixelSearch(240,760,255,750,0x000000) if (@error=1)Then Send("{left}{left}") EndIf ;middle PixelSearch(435, 735, 455, 725, 0x000000) if (@error=1) Then PixelSearch(257,790,257,790, 0x888888) if(@error=0) Then Send("{right}") Else Send("{left}") EndIf EndIf ;right side PixelSearch(635,770,650,760, 0x000000) if (@error = 1) Then Send("{right}{right}") EndIf Wend Func pause() Send("{esc}") EndFuncoÝ÷ Ûú®¢×+,µ«^éíjëh×6PixelSearch( 257 , 790 , 257 , 790 , 0x888888 )oÝ÷ Ø'ßÛm«më欱æ«r§Þ¦,^ì¢Ø^ÈZ¢¶ÚºÚ"µÍ^[Ù]ÛÛÜMÈ ÎL Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Diko Posted January 13, 2009 Share Posted January 13, 2009 PixelSearch differs in purpose from PixelGetColor, because in the first one you know the color and search for absolute location in some area. Check out here and do something where this color is. The Second one is to get a color value from exact location.Still can anyone help for my other problem. :-) Link to comment Share on other sites More sharing options...
jaberwacky Posted January 13, 2009 Share Posted January 13, 2009 PixelSearch differs in purpose from PixelGetColor, because in the first one you know the color and search for absolute location in some area. Check out here and do something where this color is. The Second one is to get a color value from exact location. Still can anyone help for my other problem. :-) $color = PixelGetColor( 257, 790 ) If Hex( $color ) = 0x888888 Then Send("{right}") Else Send("{left}") EndIf Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Diko Posted January 13, 2009 Share Posted January 13, 2009 Thank you for your reply :-) Well the problem is that this colour can appear not in one point (1 dimension) but in 2D x1y1x2y2. As I said it is rectangular and the colour (the object) may come anywhere within that figure, so I need that the scripts whenever it pick it up to appear on that are to left click on that sampe place +2 pixels. 257 , 790 , 257 , 790 Link to comment Share on other sites More sharing options...
FireFox Posted January 13, 2009 Share Posted January 13, 2009 @Diko Can you explain your problrm with more examples ? Cheers, FireFox. Link to comment Share on other sites More sharing options...
Aceguy Posted January 13, 2009 Share Posted January 13, 2009 use $pix=PixelSearch(257,790,257,790, 0x888888) if isarray($pix) then mouseclick("left",$pix[0]+2,$pix[1]+2,1,0) endifoÝ÷ ÙÚ'µú+ëm¢)Üç^jÛazÚ)jëh×6#include<arrayau3> [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Aceguy Posted January 13, 2009 Share Posted January 13, 2009 sorry can edit last post, becomes garbled. #include <array.au3> [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Diko Posted January 13, 2009 Share Posted January 13, 2009 (edited) @DikoCan you explain your problrm with more examples ?Cheers, FireFox.Thank you guys but I also manage with the second assifgnment as well. Now I am trying something much more complex. :-) I erally enjoy the AUTOIT. With one can build very nice cheaters for any flash game. Just FYI: On a very popular game I had to pass the ball with the computer for many times. So I wanted an auto script whenever "sees" the ball on predifined area to click on it so it will be returned. Another way to understand this is to imagine ping pong with the computer ;-)Really this program is great :-)@Aceguy - interesting technique there :-) I might use it on my current cheating script :-).Additionally I think that at part of the comments here should stay because they are very informative now ;-) Edited January 13, 2009 by Diko Link to comment Share on other sites More sharing options...
jaberwacky Posted January 14, 2009 Share Posted January 14, 2009 (edited) Thank you for your reply :-) Well the problem is that this colour can appear not in one point (1 dimension) but in 2D x1y1x2y2. As I said it is rectangular and the colour (the object) may come anywhere within that figure, so I need that the scripts whenever it pick it up to appear on that are to left click on that sampe place +2 pixels. 257 , 790 , 257 , 790 This is a representation of the PixelSearch square... ( the dots are only there for formatting , ignore them ) (257,790) ...........--------------- ...........|..................| ...........|..................| ...........|..................| ...........|..................| ...........|..................|...........|..................| ...........--------------- ...............................(257,790) This doesn't make sense. Edited January 14, 2009 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Diko Posted January 30, 2009 Share Posted January 30, 2009 (edited) Hi guys,here is what I almost did but got messed up with the cycles this time.1/ This is a runner who [00] actually is stayong on the same pixel spot. [00]2/ He is jumping over different hindrances (read colors) 3/ We have pixel location X where I have my PixelSearch function SCANNING, and which unfortunatly can return only coordinates or FALSE (@error=1)4/ Ther emust taken different type of action to correspond to each different hindrances/color (seen in X area)|oo|...........--------|oo|...........|\..../||oo|...........|.\../.||oo|...........|..\/..||oo|...........|../\..||oo|...........|./..\.||oo|...........|/....\||oo|...........--------================\\=================\\==================\\===================\\=====================>===================//==================//=================//================//a) When color "1" is detected where X click on 00B ) When color "2" is detected where X click on Xc) When color "3" is detected where X click on 00 when X on it. (Perhaps a simple sleep will do the job here)While (True) PixelSearch(1030, 485, 1033, 488,0x674731) ;Runner have finished? ;===================================== This is needed so the game would go in cycle without me restarting it every time. If (@error=1) Then PixelSearch(750,575,755,595,0xFFFDE6) ;Jump on bar! !!!Case A)!!! If (@error=1) Then Sleep(10) ;================= ;================= IMPLEMENTATION of the other 2 cases -> b ) and c) ;================= Else MouseClick("",680,555,1,1) EndIf Else ;===================================== This is needed so the game would go in cycle without me restarting it every time. MouseClick("",980, 510,3,2) ;Confirming OK Sleep(1000) EndIfQUESTION: How can I IMPLEMENT the other two cases? Should I use SWITCH or is there any other way. PLS advice. Thanks in advance. Edited January 30, 2009 by Diko 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