Jump to content

Pixelsearch with ElseIf and checking string


Recommended Posts

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 :)

Link to post
Share on other sites

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 by sliwek
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...