Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 09:06

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

Advertisement



Little help with pixel search

Discussion on Little help with pixel search within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Little help with pixel search

I have this piece of code, problem is when it kill mob so no more color there, he waits untill bar from mob hp dissapear from screen then he send tab and aim other mob then attack. But it need to work like, send tab until you find color (that works), send keys to kill mob (that works), send tab again after mob is dead without waiting for 5-6 seconds (that dont works). And it send keys all time, when he kill mob or search for him

Code:
Global $Run = False

HotKeySet("{F2}","_Attack")

If $pid Then
	If WinExists($win) Then
		WinActivate($win)
		Sleep(1000)
		WinMove($win, "", 0, 0, "1024", "768", 2)
		Sleep(3000)
	EndIf
Else
	MsgBox(48, "Error", "Game is not running")
	Exit
EndIf

While 1
	Sleep(200)
WEnd

Func _Attack()
	$Run = NOT $Run
	While $Run
		$find = PixelSearch(425, 20, 593, 29, $color)
		If IsArray($find) Then
			ControlSend($win, "", "", "{3}")
			Sleep(2200)
			ControlSend($win, "", "", "{4}")
			Sleep(2200)
			ControlSend($win, "", "", "{5}")
			Sleep(2500)
		Else
			ControlSend($win, "", "", "{TAB}")
			Sleep(300)
		EndIf
	WEnd
EndFunc
and i tried like this too and its same

Code:
Func _Attack()
	$Run = NOT $Run
	While $Run
		$find = PixelSearch(425, 20, 593, 29, $color)
		If @error Then
			ControlSend($win, "", "", "{TAB}")
			Sleep(300)
		Else
			ControlSend($win, "", "", "{3}")
			Sleep(2200)
			ControlSend($win, "", "", "{4}")
			Sleep(2200)
			ControlSend($win, "", "", "{5}")
			Sleep(2500)
		EndIf
	WEnd
EndFunc
mlukac89 is offline  
Old 05/18/2014, 09:41   #2
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
the loop cant get true in your code...
and $Run = Not $Run -> $Run = False
YatoDev is offline  
Old 05/18/2014, 12:03   #3
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Now script do nothing

Code:
Func _Attack()
	$Run = False
	While $Run = True
		$find = PixelSearch(425, 20, 593, 29, $color)
		If IsArray($find) Then
			ControlSend($win, "", "", "{3}")
			Sleep(2200)
			ControlSend($win, "", "", "{4}")
			Sleep(2200)
			ControlSend($win, "", "", "{5}")
			Sleep(2500)
		Else
			ControlSend($win, "", "", "{TAB}")
			Sleep(300)
		EndIf
	WEnd
EndFunc
Ok problem solved, i added pause in separate function and added tab to send first, now works fine

Code:
Func _Attack()
	While 1
		ControlSend($win, "", "", "{TAB}")
		Sleep(300)
		$find = PixelSearch(425, 20, 593, 29, $color)
		If IsArray($find) Then
			ControlSend($win, "", "", "{3}")
			Sleep(2200)
			ControlSend($win, "", "", "{4}")
			Sleep(2200)
			ControlSend($win, "", "", "{5}")
			Sleep(2500)
		Else
			ControlSend($win, "", "", "{TAB}")
			Sleep(300)
		EndIf
	WEnd
EndFunc

Func TogglePause()
    $fPaused = Not $fPaused
    While $fPaused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc
And Flutter why not $run = NOT $run look on this link
mlukac89 is offline  
Reply


Similar Threads Similar Threads
Search pixel bot
04/16/2013 - DarkOrbit - 4 Replies
Hi i search a pixel bot who can collect palla and kill alien plz or just collect
Pixel Search
05/07/2012 - AutoIt - 1 Replies
Hey, mit welchen Programm bekomme ich nochmal diese Werte her? PixelSearch(12, 174, 1028, 700, 0x59571A, 10) Danke
help with pixel search
08/08/2011 - AutoIt - 3 Replies
I need to implement in my autoit bot some changes and i am gonna use pixel search. What i exactly want is a script that start pressing a buton then compare a pixel if this pixel is grey make script 1 until pixel is not grey , when the pixel became not grey make script 2 till its finished, and when script 2 finish has to go to the compare pixel spot for starting again with script 1 till is not grey to make script 2 ...... and so on indefinitly it would be something like this?
Aoc Bot with Pixel search or how
07/20/2008 - General Gaming Releases - 0 Replies
Hi there sorry for my poor english I tryed a aoc bot , but i got several problems the enemys are fare away so i need to walk to them and then hit. i cannot get the next target cause first the bot need to look for 50m to see is there a enemy
Pixel search
02/23/2008 - Guild Wars - 18 Replies
hallihallo bin immoment dabei einen meiner eigenen bots zu optimieren und wollte ne Pixelsearchfunktion einbauen. Leider weiß ich nicht genau wie man das macht vorallem mit den farben. mein ziel: 3 verschiedene punkte im gw fenster(mit: x1;y1;;x2;y2;;x3;y3) sollen geprüft werden ob sie in GRÜN sind. falls x1;y1 grün ist -> (dollerzeichen)folge = 1 falls x2;y2 grün ist -> (dollerzeichen)folge = 2 falls x3;y3 grün ist -> (dollerzeichen)folge = 3



All times are GMT +1. The time now is 09:07.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.