Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 11:39

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

Advertisement



IF Colordetection

Discussion on IF Colordetection within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
IF Colordetection

I have the coordinates of an specific Pixel and the color of it.

Now i need help on how to work with it!

I want to make a script, that presses a key, looks if the color in that pixel is corect and if the color is corect it presses another key. if the color is wrong it presses the first key again.

and then i need a detection, that waits until the color of that specific pixel is changed and then it should start another script, where it presses another key and waits some time and then starts in the beginning with the first key again.

can somebody write me code that does something like that?
Alucard is offline  
Old 01/30/2010, 16:03   #2
 
AutoItDude's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 93
Received Thanks: 315
Code:
Global $KEY[2]=["A","B"]
Global $COLOR=0
Global $X=0,$Y=0

While 1
     LearnBasics()
WEnd

Func LearnBasics()
  Send($KEY[0])
  If PixelGetColor($X,$Y)=$COLOR Then
    Send($KEY[1])
    Return 1
  Else
    Return 0
  Endif
EndFunc
this should do the trick. learn basics.
AutoItDude is offline  
Thanks
1 User
Old 01/30/2010, 16:05   #3
 
elite*gold: 1
Join Date: Oct 2008
Posts: 1,078
Received Thanks: 276
sth. like this? :P
PHP Code:
Do
Send "{key}" ) ;ControlSend might be more comfortable

If PixelGetColor (*parameters*) = *your_PixelThen
Send 
"{anotherKey}" )
Else
Send "{key}" )
EndIf

Until PixelGetColor (*parameters*) = *your_2ndPixel*
Run (*parameters*) ;ShellExecute probably works better ;) 
edit: sry, he was faster^^
.nAno is offline  
Thanks
1 User
Old 01/30/2010, 16:18   #4
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
wow nice thanks, now i can continue messing up my scripts
Alucard is offline  
Old 01/31/2010, 17:56   #5
 
ax5's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
Hehehe good luck
ax5 is offline  
Old 02/01/2010, 11:43   #6
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
Quote:
#include <GUIConstantsEx.au3>
GUICreate("AutoIT", 335, 100)
GUISetState(@SW_SHOW)

If WinExists("ZENSIERT") Then
WinActivate("ZENSIERT")
WinWaitActive("ZENSIERT")
EndIf

While 1
fight()
WEnd


Func fight()
If PixelGetColor (560, 70) = 0xFFFFFF Then
Send("1")
Else
While Send("3")
Sleep (500)
Send("2")
Sleep (1500)
WEnd
EndIf
EndFunc
Thats my Code till now, only Problem with it, it is spamming the Keys. That is a Problem, becaus "2" is to sit down and recover and if u press it again he will stand up and stop recovering. I need the "2" only pressed once after the Pixelcolor doesn`t match.

Any suggestions for a command to insert?



das ist mein script bis jetzt. es funktioniert noch nicht wirklich gut.

"1" ist zum Angreifen
"2" ist zum Hinsetzen
"3" ist zum Loot aufsammeln

das einzige Problem am jetzigen Script ist, dass er die Tasten spammt. Was bei "1" und "3" nicht wirklich das Problem ist, dort schadet es nicht, wenn der Befehl mehrfach gesendet wird, allerdings bei "2" wird es zum Problem, da er automatisch wieder aufsteht, wenn die Taste erneut gedrückt wird.

Hat jemand eine Ahnung, welchen Befehl ich einfügen muss, damit die 2 nur einmal gesendet wird?
Alucard is offline  
Old 02/01/2010, 15:59   #7
 
elite*gold: 1
Join Date: Oct 2008
Posts: 1,078
Received Thanks: 276
was isn daran so schwer? o0

warum guckste dir nicht einfach mal die Else Anweisung in meinem Beispiel an? :P
.nAno is offline  
Old 02/01/2010, 17:34   #8
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
Quote:
Originally Posted by .nAno View Post
was isn daran so schwer? o0

warum guckste dir nicht einfach mal die Else Anweisung in meinem Beispiel an? :P
ich verstehe nicht wozu das "Run (*parameters*) da ist?!?
Alucard is offline  
Old 02/01/2010, 17:52   #9
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
Code:
Func fight()     
	If PixelGetColor (560, 70) = 0xFFFFFF Then             
		Send("1")             
	Else
		While 	
			$zahl = 0
			Do
			$zahl = $zahl + 1
				Send("3")
				Sleep (1000)
				Send("2")
				Sleep (2000)
			Until $zahl = 1
		WEnd
	EndIf 
EndFunc
Kriege

"Line 79 ....

Error: Error in expression."


was ist falsch?
Alucard is offline  
Old 02/01/2010, 18:29   #10
 
Xereon's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 793
Received Thanks: 366
"Error in expression" ist schon etwas seltsam, da du überhaupt keine hast -.-

Code:
While ;<- Hier fehlt eine Condition
Xereon is offline  
Thanks
1 User
Old 02/01/2010, 19:38   #11
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
ja gut, aber mit der variablen so funktioniert das auch nicht, kann irgendjemand den code berichtigen, so dass es funktioniert?
Alucard is offline  
Old 02/01/2010, 19:44   #12
 
AutoItDude's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 93
Received Thanks: 315
Quote:
Originally Posted by Alucard View Post
Thats my Code till now, only Problem with it, it is spamming the Keys. That is a Problem, becaus "2" is to sit down and recover and if u press it again he will stand up and stop recovering. I need the "2" only pressed once after the Pixelcolor doesn`t match.

Any suggestions for a command to insert?



das ist mein script bis jetzt. es funktioniert noch nicht wirklich gut.

"1" ist zum Angreifen
"2" ist zum Hinsetzen
"3" ist zum Loot aufsammeln

das einzige Problem am jetzigen Script ist, dass er die Tasten spammt. Was bei "1" und "3" nicht wirklich das Problem ist, dort schadet es nicht, wenn der Befehl mehrfach gesendet wird, allerdings bei "2" wird es zum Problem, da er automatisch wieder aufsteht, wenn die Taste erneut gedrückt wird.

Hat jemand eine Ahnung, welchen Befehl ich einfügen muss, damit die 2 nur einmal gesendet wird?
use memory functions, instead of pixel checking/searching to determine if you standing up or sitting. search for the bit value (0/1) in memory, get address, use it.
AutoItDude is offline  
Old 02/01/2010, 20:01   #13
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
Quote:
Originally Posted by AutoItDude View Post
use memory functions, instead of pixel checking/searching to determine if you standing up or sitting. search for the bit value (0/1) in memory, get address, use it.
when i get u the adress, can u write me the code i need? i am new to autoit as u can see

4bit

061C3188

0 is standing
1 is sitting
Alucard is offline  
Old 02/01/2010, 20:09   #14
 
Xereon's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 793
Received Thanks: 366
Quote:
Originally Posted by Alucard View Post
ja gut, aber mit der variablen so funktioniert das auch nicht, kann irgendjemand den code berichtigen, so dass es funktioniert?
Wie wäre es mit literalen Konstanten wie zB 1,4,8,4,true usw?
Xereon is offline  
Old 02/01/2010, 20:17   #15
 
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
Quote:
Originally Posted by Xereon View Post
Wie wäre es mit literalen Konstanten wie zB 1,4,8,4,true usw?
ich versteh nur bahnhof O_o
Alucard is offline  
Reply




All times are GMT +2. The time now is 11:39.


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