|
You last visited: Today at 11:39
Advertisement
IF Colordetection
Discussion on IF Colordetection within the AutoIt forum part of the Coders Den category.
01/30/2010, 15:10
|
#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?
|
|
|
01/30/2010, 16:03
|
#2
|
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.
|
|
|
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_Pixel* Then Send ( "{anotherKey}" ) Else Send ( "{key}" ) EndIf
Until PixelGetColor (*parameters*) = *your_2ndPixel* Run (*parameters*) ;ShellExecute probably works better ;)
edit: sry, he was faster^^
|
|
|
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
|
|
|
01/31/2010, 17:56
|
#5
|
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
|
Hehehe good luck
|
|
|
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?
|
|
|
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
|
|
|
02/01/2010, 17:34
|
#8
|
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
|
Quote:
Originally Posted by .nAno
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?!?
|
|
|
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?
|
|
|
02/01/2010, 18:29
|
#10
|
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
|
|
|
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?
|
|
|
02/01/2010, 19:44
|
#12
|
elite*gold: 0
Join Date: Oct 2009
Posts: 93
Received Thanks: 315
|
Quote:
Originally Posted by Alucard
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.
|
|
|
02/01/2010, 20:01
|
#13
|
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
|
Quote:
Originally Posted by AutoItDude
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
|
|
|
02/01/2010, 20:09
|
#14
|
elite*gold: 0
Join Date: Apr 2009
Posts: 793
Received Thanks: 366
|
Quote:
Originally Posted by Alucard
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?
|
|
|
02/01/2010, 20:17
|
#15
|
elite*gold: 0
Join Date: Aug 2004
Posts: 333
Received Thanks: 46
|
Quote:
Originally Posted by Xereon
Wie wäre es mit literalen Konstanten wie zB 1,4,8,4,true usw?
|
ich versteh nur bahnhof O_o
|
|
|
All times are GMT +2. The time now is 11:39.
|
|