Andrejj Posted December 24, 2011 Posted December 24, 2011 Hello, I have two problems where I can't find a solution currently. I have a snippet which does something if it finds a special color on a predefinied pixel. If the color cant be find it will set the global variable $count2 to 1: Local $coord = PixelSearch(321, 300, 321, 300, 0xBB9200) If Not @error Then Send("{esc}") Sleep(100) Send("{esc}") Else $count2 = 1 EndIf Now I want to change the Else to an ElseIf and make another Pixelsearch. I tried this one but it doesnt work: Local $coord = PixelSearch(321, 300, 321, 300, 0xBB9200) If Not @error Then Send("{esc}") Sleep(100) Send("{esc}") ElseIf Local $coord = PixelSearch(321, 300, 321, 300, 0xBB9200) If Not @error Then Send("{esc}") Sleep(100) Send("{esc}") Else $count2 = 1 EndIf Someone knows how its done right? Now the other thing: I am generationg a random String with twelve letters: $zeichen = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" $string = StringSplit($zeichen, "") $anzahl_der_zeichen = 12 $zeichen2 = "" For $i = 1 To $anzahl_der_zeichen $zeichen2 &= $string[Random(1, UBound($string) - 1)] Next Now I want the script to check if the same letter is appearing three times consecutively. If this is happening the script should loop one more time and generate a new string until the check is false. Thanks for your help and a merry christmas to everyone here
ChrisN Posted December 24, 2011 Posted December 24, 2011 ElseIf needs a test condition. Did you read the help topic for If..ElseIf...Else...Endif ?
sliwek Posted December 27, 2011 Posted December 27, 2011 (edited) mayby u want do something like that Local $coord = PixelSearch(321, 300, 321, 300, 0xBB9200) If Not @error Then Send("{esc}") Sleep(100) Send("{esc}") ElseIf @error Then ;<<<<<<<<<<<<<<<<<<< Local $coord = PixelSearch(321, 300, 321, 300, 0xBB9200) If Not @error Then Send("{esc}") Sleep(100) Send("{esc}") Else $count2 = 1 EndIf ; <<<<<<<<<<<<<<<<<< EndIf Edited December 27, 2011 by sliwek
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