Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;*Coded by GkevinOD
- $HWnD = WinGetHandle (WinGetTitle ("BlueStacks App Player"))
- $BlueStacks_XY = WinGetPos($HWnD, "")
- Global $x = $BlueStacks_XY [0] + 53 ;May need to be edited to the first pixel in the upper-left corner of the first GOLD digit
- Global $y = $BlueStacks_XY [1] + 94 ;May need to be edited to the first pixel in the upper-left corner of the first GOLD digit
- Global $Gold
- $Gold &= getDigitGold($x, $y)
- $Gold &= getDigitGold($x, $y)
- $Gold &= getDigitGold($x, $y)
- $x += 6 ;The space that seperate the gold into two sections, usually 5 or 6 pixels long. Ex: "123 321"
- $Gold &= getDigitGold($x, $y)
- $Gold &= getDigitGold($x, $y)
- $Gold &= getDigitGold($x, $y)
- MsgBox(0, "Gold Search", "Gold: " & $Gold)
- ;************************************************************************
- ; This codes are only for Gold because it detects the pattern of the colors to get the digits and GOLD has slightly different color from ELIXIR
- ; Has very high accuracy, occasionally the Y coordination may be 1 pixel off.
- ;
- ; *Must have 860x720 Resolution!
- ;
- ; Instructions:
- ; 1) Find a match
- ; 2) Run the script
- ; 3) MsgBox should appear with the gold
- ;
- ; May take a couple of seconds for message box to appear due to multiple uses on PixelSearch.
- ; If you are able to improve the code to make it faster, please share in the forums.
- ;************************************************************************
- Func boolPixelSearch($pixel1, $pixel2, $pixel3)
- If IsArray(PixelSearch($pixel1[0], $pixel1[1], $pixel1[0], $pixel1[1], $pixel1[2], 10)) = True And IsArray(PixelSearch($pixel2[0], $pixel2[1], $pixel2[0], $pixel2[1], $pixel2[2], 10)) = True And IsArray(PixelSearch($pixel3[0], $pixel3[1], $pixel3[0], $pixel3[1], $pixel3[2], 10)) = True Then
- Return True ;Checks if each PixelSearch is an array indicating that it has been found in that location.
- Else
- Return False
- EndIf
- EndFunc
- Func getDigitGold(ByRef $x, $y)
- Local $width = 0
- ;Search for digit 0
- $width = 13
- Local $pixel1[3] = [$x+6, $y+4, 0x989579], $pixel2[3] = [$x+7, $y+7, 0x39382E], $pixel3[3] = [$x+10, $y+13, 0x272720] ;Uses one pixel and color to check a 3 pixel pattern found in certain locations
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width ;Adds to x coordinate to get the next digit
- Return 0
- Else
- $x -= 1 ;Solves the problem when the spaces between the middle goes from 6 to 5 pixels
- Local $pixel1[3] = [$x+6, $y+4, 0x989579], $pixel2[3] = [$x+7, $y+7, 0x39382E], $pixel3[3] = [$x+10, $y+13, 0x272720]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width ;Changes x coordinate for the next digit.
- Return 0
- Else
- $x += 2 ;Solves the problem when there is 1 pixel space between a set of numbers
- Local $pixel1[3] = [$x+6, $y+4, 0x989579], $pixel2[3] = [$x+7, $y+7, 0x39382E], $pixel3[3] = [$x+10, $y+13, 0x272720]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 0
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 1
- $width = 6
- Local $pixel1[3] = [$x+1, $y+1, 0x969478], $pixel2[3] = [$x+1, $y+12, 0x313027], $pixel3[3] = [$x+4, $y+12, 0xD8D4AC]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 1
- Else
- $x -= 1
- Local $pixel1[3] = [$x+1, $y+1, 0x969478], $pixel2[3] = [$x+1, $y+12, 0x313027], $pixel3[3] = [$x+4, $y+12, 0xD8D4AC]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 1
- Else
- $x += 2
- Local $pixel1[3] = [$x+1, $y+1, 0x969478], $pixel2[3] = [$x+1, $y+12, 0x313027], $pixel3[3] = [$x+4, $y+12, 0xD8D4AC]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 1
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 2
- $width = 10
- Local $pixel1[3] = [$x+1, $y+7, 0xA09D80], $pixel2[3] = [$x+3, $y+6, 0xD8D4AC], $pixel3[3] = [$x+4, $y+5, 0x77755F]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 2
- Else
- $x -= 1
- Local $pixel1[3] = [$x+1, $y+7, 0xA09D80], $pixel2[3] = [$x+3, $y+6, 0xD8D4AC], $pixel3[3] = [$x+4, $y+5, 0x77755F]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 2
- Else
- $x += 2
- Local $pixel1[3] = [$x+1, $y+7, 0xA09D80], $pixel2[3] = [$x+3, $y+6, 0xD8D4AC], $pixel3[3] = [$x+4, $y+5, 0x77755F]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 2
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 3
- $width = 10
- Local $pixel1[3] = [$x+8, $y+6, 0x1A1A15], $pixel2[3] = [$x+4, $y+8, 0x070706], $pixel3[3] = [$x+8, $y+1, 0x575646]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 3
- Else
- $x -= 1
- Local $pixel1[3] = [$x+8, $y+6, 0x1A1A15], $pixel2[3] = [$x+4, $y+8, 0x070706], $pixel3[3] = [$x+8, $y+1, 0x575646]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 3
- Else
- $x += 2
- Local $pixel1[3] = [$x+8, $y+6, 0x1A1A15], $pixel2[3] = [$x+4, $y+8, 0x070706], $pixel3[3] = [$x+8, $y+1, 0x575646]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 3
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 4
- $width = 12
- Local $pixel1[3] = [$x+2, $y+3, 0x282720], $pixel2[3] = [$x+3, $y+1, 0x080806], $pixel3[3] = [$x+1, $y+5, 0x403F33]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 4
- Else
- $x -= 1
- Local $pixel1[3] = [$x+2, $y+3, 0x282720], $pixel2[3] = [$x+3, $y+1, 0x080806], $pixel3[3] = [$x+1, $y+5, 0x403F33]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 4
- Else
- $x += 2
- Local $pixel1[3] = [$x+2, $y+3, 0x282720], $pixel2[3] = [$x+3, $y+1, 0x080806], $pixel3[3] = [$x+1, $y+5, 0x403F33]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 4
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 5
- $width = 10
- Local $pixel1[3] = [$x+5, $y+4, 0x060605], $pixel2[3] = [$x+4, $y+9, 0x040403], $pixel3[3] = [$x+7, $y+12, 0x5F5D4C]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 5
- Else
- $x -= 1
- Local $pixel1[3] = [$x+5, $y+4, 0x060605], $pixel2[3] = [$x+4, $y+9, 0x040403], $pixel3[3] = [$x+7, $y+12, 0x5F5D4C]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 5
- Else
- $x += 2
- Local $pixel1[3] = [$x+5, $y+4, 0x060605], $pixel2[3] = [$x+4, $y+9, 0x040403], $pixel3[3] = [$x+7, $y+12, 0x5F5D4C]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 5
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 6
- $width = 11
- Local $pixel1[3] = [$x+5, $y+4, 0x070605], $pixel2[3] = [$x+5, $y+9, 0x040403], $pixel3[3] = [$x+8, $y+5, 0x181713]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 6
- Else
- $x -= 1
- Local $pixel1[3] = [$x+5, $y+4, 0x070605], $pixel2[3] = [$x+5, $y+9, 0x040403], $pixel3[3] = [$x+8, $y+5, 0x181713]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 6
- Else
- $x += 2
- Local $pixel1[3] = [$x+5, $y+4, 0x070605], $pixel2[3] = [$x+5, $y+9, 0x040403], $pixel3[3] = [$x+8, $y+5, 0x181713]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 6
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 7
- $width = 10
- Local $pixel1[3] = [$x+5, $y+11, 0x5E5C4B], $pixel2[3] = [$x+6, $y+9, 0x5D5C4B], $pixel3[3] = [$x+7, $y+7, 0x5D5C4B]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 7
- Else
- $x -= 1
- Local $pixel1[3] = [$x+5, $y+11, 0x5E5C4B], $pixel2[3] = [$x+6, $y+9, 0x5D5C4B], $pixel3[3] = [$x+7, $y+7, 0x5D5C4B]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 7
- Else
- $x += 2
- Local $pixel1[3] = [$x+5, $y+11, 0x5E5C4B], $pixel2[3] = [$x+6, $y+9, 0x5D5C4B], $pixel3[3] = [$x+7, $y+7, 0x5D5C4B]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 7
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 8
- $width = 12
- Local $pixel1[3] = [$x+5, $y+3, 0x27261F], $pixel2[3] = [$x+5, $y+10, 0x302F26], $pixel3[3] = [$x+1, $y+6, 0x26261F]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 8
- Else
- $x -= 1
- Local $pixel1[3] = [$x+5, $y+3, 0x27261F], $pixel2[3] = [$x+5, $y+10, 0x302F26], $pixel3[3] = [$x+1, $y+6, 0x26261F]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 8
- Else
- $x += 2
- Local $pixel1[3] = [$x+5, $y+3, 0x27261F], $pixel2[3] = [$x+5, $y+10, 0x302F26], $pixel3[3] = [$x+1, $y+6, 0x26261F]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 8
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- ;Search for digit 9
- $width = 11
- Local $pixel1[3] = [$x+5, $y+5, 0x302F26], $pixel2[3] = [$x+5, $y+9, 0x050504], $pixel3[3] = [$x+8, $y+12, 0x272720]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 9
- Else
- $x -= 1
- Local $pixel1[3] = [$x+5, $y+5, 0x302F26], $pixel2[3] = [$x+5, $y+9, 0x050504], $pixel3[3] = [$x+8, $y+12, 0x272720]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 9
- Else
- $x += 2
- Local $pixel1[3] = [$x+5, $y+5, 0x302F26], $pixel2[3] = [$x+5, $y+9, 0x050504], $pixel3[3] = [$x+8, $y+12, 0x272720]
- If boolPixelSearch($pixel1, $pixel2, $pixel3) = True Then
- $x += $width
- Return 9
- Else
- $x -= 1
- EndIf
- EndIf
- EndIf
- Return "" ;Returns nothing to when there are no matches, usually when the number is below 100k
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement