Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 04:42

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[AutoIt SciTe] Problem with PixelSearch command.

Discussion on [AutoIt SciTe] Problem with PixelSearch command. within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2017
Posts: 3
Received Thanks: 0
Question [AutoIt SciTe] Problem with PixelSearch command.

Hi.

I want to make a bot that can play a game called Piano Tiles 2

But the problem is that when it gets too fast, the mouse miss the tile and touchs the border

I use the variable $DELAYED_TILE_ESTIMATE in my script

I use PixelSearch command to check if a tile is detected
If is detected a black pixel in the region of PixelSearch command,
I use MouseMove(*cords*) to move the mouse and
MouseClick to click the tile

I want to do a code after MouseMove that can "imagine" a line at the top of the mouse position and check how much pixels of that line are off the tile, after it checks for the position, move the mouse to a place where it can touch the tile and not the border.

Graphic explanation here:

$DELAYED_TILE_ESTIMATE is the variable that i want to assign to store the value that the imaginary red line calculated and add it to the Y coordinate
of MouseMove(*Cords*) command

Example: 50 pixels off the tile:

$_NEGATIVE_PIXELS is the amount of pixels of the red line that are off the tile

$DELAYED_TILE_ESTIMATE = $_NEGATIVE_PIXELS

then

MouseMove(*cord1*, *cord2 + $DELAYED_TILE_ESTIMATE*, *cord3*)

So after moving the mouse once, the red line will calculate, and move the mouse inside the tile so it wont miss it




Thanks a lot for reading :)
DynamicRookie is offline  
Old 12/31/2017, 01:57   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
Use control click instead of mousemove, u don't have the delay of simulated mousemove, also, when you search for a pixel it will always return the top left corner, since the scan goes TOP LEFT to RIGHT BOTTOM, u need some offset for the click based on tile size.
Control click won't work on bluestacks, in nox works.
elmarcia is offline  
Old 12/31/2017, 13:45   #3

 
Moneypulation's Avatar
 
elite*gold: 138
Join Date: Apr 2012
Posts: 3,494
Received Thanks: 1,769
You can just use MouseMove(x,y,0) as well to get rid of the delay. If you don't want to click near the borders, just use an offset as already mentioned
Moneypulation is offline  
Old 12/31/2017, 16:33   #4
 
elite*gold: 0
Join Date: Dec 2017
Posts: 3
Received Thanks: 0
Thanks a lot for our answers!

But yes, i do use MouseMove and ControlClick but it still lags when searching for pixels

The real problem is that when it gets too fast, the bot doesn't have enough time to scan and touch the tile in time, so i thought about moving the mouse to the certain position where the tile was detected and using MouseGetPos statement to check -15 Y up the mouse, and if a blue tile is detected, use MouseMove again to move the mouse inside the tile.

The code of detecting tiles is this
Func pixs()
While 1
$pix1 = PixelSearch(400, 600, 500, 600, 0x000000, 100, 1)
If IsArray("$pix1") = True Then
MouseMove(450, 600, p)
MouseClick("left")




I thought about doing this code but it doesn't work



$pos = MouseGetPos()
$negative_tiles = PixelSearch($pos[0] -15, $pos[1] -15, $pos[0] + 15, $pos[1] +15, 0x(Color blue hex code), 100, 1)
If IsArray($negative_tiles) = True Then
MouseMove($pos[0], $pos[1] + 15, 0)
MouseClick("left")
Else
MouseClick("left")
Endif
Endif
WEnd
EndFunc

Anyone knows how i could improve that code?

Thanks
DynamicRookie is offline  
Reply


Similar Threads Similar Threads
Autoit Scite kann man nicht Koda mit tolls öfnen
03/23/2012 - AutoIt - 4 Replies
frage steht im Thread Danke im voraus:handsdown:
[AutoIT][Scite]Calltips und Syntax Highlighting
11/12/2010 - Coding Tutorials - 4 Replies
Eigene Calltips und eigenes Syntax Highlighting in Scite _____________________________________________ Übersicht Vorwort Ändern der Userfiles
AutoIt SCite+Koda und allem drum und dran
10/01/2010 - AutoIt - 3 Replies
Könntet ihr mir den Downloadlink von dem SCite Script Editor (neueste Version)geben wo Koda und alles andere dabei ist. Ps:hab gegoogelt aber nur ne alte version gefunden
Protable AutoIt / Scite gesucht
05/03/2009 - Guild Wars - 5 Replies
Hi, wie der Titel schon sagt ich suche ein Portables AutoIt btw. Scite mit vollen Funktionen wie auch beim richtigen install. Habe unter google zwar einige gefunden nur bisher sind das alles ältere versionen oder halt downloads bei den man sich net so sicher sein kann ob es sauber ist oder kosten auf kommen. Wäre nett wenn des jemand hat, wenn nicht dann auch net so wild. danke aber im vorraus. gruß *-.- soll natürlich Portable heißen !^^



All times are GMT +1. The time now is 04:42.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.