The Bytecode Club
Log inJoin the club
Video Game Reverse Engineering

My Addition: Village Report (for v5.5.x.x)

Started by Hervidero · Feb 9, 2015

7 replies97,369 views
Feb 9, 2015#1

@DEVS

I Created a Village Report function to report back the village's resources.
Maybe helpful for statistics or auto walling ;-)

Short description:
It reads the resource values of your Gold, Elixir, Dark Elixir and Gems Count from the Builder/Shop page instead of homescreen.
(The homescreen resources have a bar behind the numbers conflicting with the pixel reading)
It also checks for a free builder, this maybe needed to make an auto walling function work properly.

It still needs some work, and Variables are set to Local, for other purposes it will be necessary to make them global.
I made some additions to the function GetOther.au3 for the new values.
And also to the GetDigit.au3 file because the digits 0, 1, 2 and 3 need slightly different Hex values, the rest of the digits seem fine.

Anyway here it is:

VillageReport.au3 (NEW)

Func VillageReport()
	ClickP($TopLeftClient) ;Click Away
	If _Sleep(500) Then Return

    SetLog("Village Report", $COLOR_GREEN)

	Local $FreeBuilder = GetOther(324,23, "Builder")
	Setlog("Nr of Free Builders: " & $FreeBuilder, $COLOR_GREEN)

	SetLog("Opening Builder page to read Resources..", $COLOR_BLUE)
	Click(388,30) ; Click Builder Button
	If _Sleep(500) Then Return

	Local $GoldCount   = GetOther(440,625, "Resource")
	Local $ElixirCount = GetOther(282,625, "Resource")
	Local $DarkCount   = GetOther(125,625, "Resource")
	Local $GemCount    = GetOther(606,625, "Gems")

	Click (820,40) ; Close Builder/Shop

	SetLog("Resources: [G]: " & $GoldCount & " [E]: " & $ElixirCount & " [D]: " & $DarkCount & " [GEM]: " & $GemCount, $COLOR_GREEN)
EndFunc

GetOther.au3 (CHANGES)

;Returns complete value of other

Func getOther($x_start, $y_start, $type)
	;_CaptureRegion(0, 0, $x_start + 90, $y_start + 20) ; turned off, +90 is not enough to read resources
	_CaptureRegion() ; use whole screen for now
	;-----------------------------------------------------------------------------
	Local $x = $x_start, $y = $y_start
	Local $Number, $i = 0

	Switch $type
		Case "Trophy"
			$Number = getDigit($x, $y, "Other")

			While $Number = ""
				If $i >= 50 Then ExitLoop
				$i += 1
				$x += 1
				$Number = getDigit($x, $y, "Other")
			WEnd

			$Number &= getDigit($x, $y, "Other")
			$Number &= getDigit($x, $y, "Other")
			$Number &= getDigit($x, $y, "Other")

		Case "Builder"
			$Number = getDigit($x, $y, "Builder")

			While $Number = ""
				If $i >= 10 Then ExitLoop
				$i += 1
				$x += 1
				$Number = getDigit($x, $y, "Builder")
			WEnd

		Case "Gems"
			$Number = getDigit($x, $y, "Other")

			While $Number = ""
				If $i >= 90 Then ExitLoop
				$i += 1
				$x += 1
				$Number = getDigit($x, $y, "Other")
			WEnd

			$Number &= getDigit($x, $y, "Other")
			$Number &= getDigit($x, $y, "Other")
			$Number &= getDigit($x, $y, "Other")
			$x += 6
			$Number &= getDigit($x, $y, "Other")
			$Number &= getDigit($x, $y, "Other")
			$Number &= getDigit($x, $y, "Other")

		Case "Resource"
			$Number = getDigit($x, $y, "Resource")

			While $Number = ""
				If $i >= 120 Then ExitLoop
				$i += 1
				$x += 1
				$Number = getDigit($x, $y, "Resource")
			WEnd

			$Number &= getDigit($x, $y, "Resource")
			$Number &= getDigit($x, $y, "Resource")
			$Number &= getDigit($x, $y, "Resource")
			$x += 6
			$Number &= getDigit($x, $y, "Resource")
			$Number &= getDigit($x, $y, "Resource")
			$Number &= getDigit($x, $y, "Resource")
			$x += 6
			$Number &= getDigit($x, $y, "Resource")
			$Number &= getDigit($x, $y, "Resource")
			$Number &= getDigit($x, $y, "Resource")

	EndSwitch

	Return $Number
EndFunc   ;==>getOther

GetDigit.au3 (Modified HEX values for digits 0-3)

;==============================================================================================================
;===Get Digit=============================================================================================
;--------------------------------------------------------------------------------------------------------------
;Finds pixel color pattern of specific X and Y values, returns digit if pixel color pattern found.
;--------------------------------------------------------------------------------------------------------------

Func getDigit(ByRef $x, $y, $type)
	Local $width = 0

	;Search for digit 0
	$width = 13
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x989579, 6), $c2 = Hex(0x39382E, 6), $c3 = Hex(0x272720, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x978A96, 6), $c2 = Hex(0x393439, 6), $c3 = Hex(0x272427, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x909090, 6), $c2 = Hex(0x363636, 6), $c3 = Hex(0x262626, 6)
		Case $type = "Builder"
			Local $c1 = Hex(0x979797, 6), $c2 = Hex(0x373737, 6), $c3 = Hex(0x262626, 6)
		Case $type = "Resource"
			Local $c1 = Hex(0x919191, 6), $c2 = Hex(0x373737, 6), $c3 = Hex(0x272727, 6)
		Case Else
			Local $c1 = Hex(0x979797, 6), $c2 = Hex(0x393939, 6), $c3 = Hex(0x272727, 6)
	EndSelect
	Local $pixel1[3] = [$x + 6, $y + 4, $c1], $pixel2[3] = [$x + 7, $y + 7, $c2], $pixel3[3] = [$x + 10, $y + 13, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) 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, $c1], $pixel2[3] = [$x + 7, $y + 7, $c2], $pixel3[3] = [$x + 10, $y + 13, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) 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, $c1], $pixel2[3] = [$x + 7, $y + 7, $c2], $pixel3[3] = [$x + 10, $y + 13, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 0
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 1
	$width = 6
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x979478, 6), $c2 = Hex(0x313127, 6), $c3 = Hex(0xD7D4AC, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x968895, 6), $c2 = Hex(0x312D31, 6), $c3 = Hex(0xD8C4D6, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x8F8F8F, 6), $c2 = Hex(0x2F2F2F, 6), $c3 = Hex(0xCDCDCD, 6)
		Case $type = "Resource"
			Local $c1 = Hex(0x919191, 6), $c2 = Hex(0x303030, 6), $c3 = Hex(0xD0D0D0, 6)
		Case Else
			Local $c1 = Hex(0x969696, 6), $c2 = Hex(0x313131, 6), $c3 = Hex(0xD8D8D8, 6)
	EndSelect
	Local $pixel1[3] = [$x + 1, $y + 1, $c1], $pixel2[3] = [$x + 1, $y + 12, $c2], $pixel3[3] = [$x + 4, $y + 12, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 1
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 1, $y + 1, $c1], $pixel2[3] = [$x + 1, $y + 12, $c2], $pixel3[3] = [$x + 4, $y + 12, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 1
		Else
			$x += 2
			Local $pixel1[3] = [$x + 1, $y + 1, $c1], $pixel2[3] = [$x + 1, $y + 12, $c2], $pixel3[3] = [$x + 4, $y + 12, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 1
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 2
	$width = 10
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0xA09E80, 6), $c2 = Hex(0xD8D4AC, 6), $c3 = Hex(0x979579, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0xA0919F, 6), $c2 = Hex(0xD8C4D6, 6), $c3 = Hex(0x978A96, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x989898, 6), $c2 = Hex(0xCDCDCD, 6), $c3 = Hex(0x909090, 6)
		Case $type = "Resource"
			Local $c1 = Hex(0x9E99A0, 6), $c2 = Hex(0xD3D3D3, 6), $c3 = Hex(0x919191, 6)
		Case Else
			Local $c1 = Hex(0xA0A0A0, 6), $c2 = Hex(0xD8D8D8, 6), $c3 = Hex(0x979797, 6)
	EndSelect
	Local $pixel1[3] = [$x + 1, $y + 7, $c1], $pixel2[3] = [$x + 3, $y + 6, $c2], $pixel3[3] = [$x + 7, $y + 7, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 2
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 1, $y + 7, $c1], $pixel2[3] = [$x + 3, $y + 6, $c2], $pixel3[3] = [$x + 7, $y + 7, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 2
		Else
			$x += 2
			Local $pixel1[3] = [$x + 1, $y + 7, $c1], $pixel2[3] = [$x + 3, $y + 6, $c2], $pixel3[3] = [$x + 7, $y + 7, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 2
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 3
	$width = 10
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x7F7D65, 6), $c2 = Hex(0x070706, 6), $c3 = Hex(0x37362C, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x7F737E, 6), $c2 = Hex(0x070607, 6), $c3 = Hex(0x373236, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x797979, 6), $c2 = Hex(0x070707, 6), $c3 = Hex(0x343434, 6)
		Case $type = "Resource"
			Local $c1 = Hex(0x7A7A7A, 6), $c2 = Hex(0x070707, 6), $c3 = Hex(0x373737, 6)
		Case Else
			Local $c1 = Hex(0x7F7F7F, 6), $c2 = Hex(0x070707, 6), $c3 = Hex(0x373737, 6)
	EndSelect
	Local $pixel1[3] = [$x + 2, $y + 3, $c1], $pixel2[3] = [$x + 4, $y + 8, $c2], $pixel3[3] = [$x + 5, $y + 13, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 3
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 2, $y + 3, $c1], $pixel2[3] = [$x + 4, $y + 8, $c2], $pixel3[3] = [$x + 5, $y + 13, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 3
		Else
			$x += 2
			Local $pixel1[3] = [$x + 2, $y + 3, $c1], $pixel2[3] = [$x + 4, $y + 8, $c2], $pixel3[3] = [$x + 5, $y + 13, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 3
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 4
	$width = 12
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x282720, 6), $c2 = Hex(0x080806, 6), $c3 = Hex(0x403F33, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x282428, 6), $c2 = Hex(0x080708, 6), $c3 = Hex(0x403A40, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x262626, 6), $c2 = Hex(0x070707, 6), $c3 = Hex(0x3D3D3D, 6)
		Case Else
			Local $c1 = Hex(0x282828, 6), $c2 = Hex(0x080808, 6), $c3 = Hex(0x404040, 6)
	EndSelect
	Local $pixel1[3] = [$x + 2, $y + 3, $c1], $pixel2[3] = [$x + 3, $y + 1, $c2], $pixel3[3] = [$x + 1, $y + 5, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 4
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 2, $y + 3, $c1], $pixel2[3] = [$x + 3, $y + 1, $c2], $pixel3[3] = [$x + 1, $y + 5, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 4
		Else
			$x += 2
			Local $pixel1[3] = [$x + 2, $y + 3, $c1], $pixel2[3] = [$x + 3, $y + 1, $c2], $pixel3[3] = [$x + 1, $y + 5, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 4
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 5
	$width = 10
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x060604, 6), $c2 = Hex(0x040403, 6), $c3 = Hex(0xB7B492, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x060606, 6), $c2 = Hex(0x040404, 6), $c3 = Hex(0xB7A7B6, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x060606, 6), $c2 = Hex(0x040404, 6), $c3 = Hex(0xAFAFAF, 6)
		Case Else
			Local $c1 = Hex(0x060606, 6), $c2 = Hex(0x040404, 6), $c3 = Hex(0xB7B7B7, 6)
	EndSelect
	Local $pixel1[3] = [$x + 5, $y + 4, $c1], $pixel2[3] = [$x + 4, $y + 9, $c2], $pixel3[3] = [$x + 6, $y + 12, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 5
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 5, $y + 4, $c1], $pixel2[3] = [$x + 4, $y + 9, $c2], $pixel3[3] = [$x + 6, $y + 12, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 5
		Else
			$x += 2
			Local $pixel1[3] = [$x + 5, $y + 4, $c1], $pixel2[3] = [$x + 4, $y + 9, $c2], $pixel3[3] = [$x + 6, $y + 12, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 5
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 6
	$width = 11
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x070605, 6), $c2 = Hex(0x040403, 6), $c3 = Hex(0x181713, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x070707, 6), $c2 = Hex(0x040404, 6), $c3 = Hex(0x181618, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x060606, 6), $c2 = Hex(0x030303, 6), $c3 = Hex(0x161616, 6)
		Case Else
			Local $c1 = Hex(0x070707, 6), $c2 = Hex(0x040404, 6), $c3 = Hex(0x181818, 6)
	EndSelect
	Local $pixel1[3] = [$x + 5, $y + 4, $c1], $pixel2[3] = [$x + 5, $y + 9, $c2], $pixel3[3] = [$x + 8, $y + 5, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 6
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 5, $y + 4, $c1], $pixel2[3] = [$x + 5, $y + 9, $c2], $pixel3[3] = [$x + 8, $y + 5, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 6
		Else
			$x += 2
			Local $pixel1[3] = [$x + 5, $y + 4, $c1], $pixel2[3] = [$x + 5, $y + 9, $c2], $pixel3[3] = [$x + 8, $y + 5, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 6
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 7
	$width = 10
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x5E5C4B, 6), $c2 = Hex(0x87856C, 6), $c3 = Hex(0x5D5C4B, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x5F565E, 6), $c2 = Hex(0x877B86, 6), $c3 = Hex(0x5F565E, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x5A5A5A, 6), $c2 = Hex(0x818181, 6), $c3 = Hex(0x5A5A5A, 6)
		Case Else
			Local $c1 = Hex(0x5F5F5F, 6), $c2 = Hex(0x878787, 6), $c3 = Hex(0x5F5F5F, 6)
	EndSelect
	Local $pixel1[3] = [$x + 5, $y + 11, $c1], $pixel2[3] = [$x + 4, $y + 3, $c2], $pixel3[3] = [$x + 7, $y + 7, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 7
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 5, $y + 11, $c1], $pixel2[3] = [$x + 4, $y + 3, $c2], $pixel3[3] = [$x + 7, $y + 7, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 7
		Else
			$x += 2
			Local $pixel1[3] = [$x + 5, $y + 11, $c1], $pixel2[3] = [$x + 4, $y + 3, $c2], $pixel3[3] = [$x + 7, $y + 7, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 7
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 8
	$width = 11
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x27261F, 6), $c2 = Hex(0x302F26, 6), $c3 = Hex(0x26261F, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x272427, 6), $c2 = Hex(0x302B2F, 6), $c3 = Hex(0x26261F, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x252525, 6), $c2 = Hex(0x2D2D2D, 6), $c3 = Hex(0x242424, 6)
		Case Else
			Local $c1 = Hex(0x272727, 6), $c2 = Hex(0x303030, 6), $c3 = Hex(0x262626, 6)
	EndSelect
	Local $pixel1[3] = [$x + 5, $y + 3, $c1], $pixel2[3] = [$x + 5, $y + 10, $c2], $pixel3[3] = [$x + 1, $y + 6, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 8
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 5, $y + 3, $c1], $pixel2[3] = [$x + 5, $y + 10, $c2], $pixel3[3] = [$x + 1, $y + 6, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 8
		Else
			$x += 2
			Local $pixel1[3] = [$x + 5, $y + 3, $c1], $pixel2[3] = [$x + 5, $y + 10, $c2], $pixel3[3] = [$x + 1, $y + 6, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 8
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 9
	$width = 11
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x302F26, 6), $c2 = Hex(0x050504, 6), $c3 = Hex(0x272720, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x302C30, 6), $c2 = Hex(0x050505, 6), $c3 = Hex(0x282427, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x2E2E2E, 6), $c2 = Hex(0x050505, 6), $c3 = Hex(0x262626, 6)
		Case Else
			Local $c1 = Hex(0x303030, 6), $c2 = Hex(0x050505, 6), $c3 = Hex(0x272727, 6)
	EndSelect
	Local $pixel1[3] = [$x + 5, $y + 5, $c1], $pixel2[3] = [$x + 5, $y + 9, $c2], $pixel3[3] = [$x + 8, $y + 12, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 9
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 5, $y + 5, $c1], $pixel2[3] = [$x + 5, $y + 9, $c2], $pixel3[3] = [$x + 8, $y + 12, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 9
		Else
			$x += 2
			Local $pixel1[3] = [$x + 5, $y + 5, $c1], $pixel2[3] = [$x + 5, $y + 9, $c2], $pixel3[3] = [$x + 8, $y + 12, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 9
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf

	;Search for digit 74
	$width = 21
	Select
		Case $type = "Gold"
			Local $c1 = Hex(0x414034, 6), $c2 = Hex(0x4C4B3D, 6), $c3 = Hex(0xD3D0A9, 6)
		Case $type = "Elixir"
			Local $c1 = Hex(0x413E38, 6), $c2 = Hex(0x4C4941, 6), $c3 = Hex(0xD3CEAB, 6)
		Case $type = "DarkElixir"
			Local $c1 = Hex(0x3F3F3F, 6), $c2 = Hex(0x4A4A4A, 6), $c3 = Hex(0xD1D1D1, 6)
		Case Else
			Local $c1 = Hex(0x414141, 6), $c2 = Hex(0x4C4C4C, 6), $c3 = Hex(0xD3D3D3, 6)
	EndSelect
	Local $pixel1[3] = [$x + 13, $y + 7, $c1], $pixel2[3] = [$x + 7, $y + 7, $c2], $pixel3[3] = [$x + 1, $y + 12, $c3]
	If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
		$x += $width
		Return 9
	Else
		$x -= 1
		Local $pixel1[3] = [$x + 13, $y + 7, $c1], $pixel2[3] = [$x + 7, $y + 7, $c2], $pixel3[3] = [$x + 1, $y + 12, $c3]
		If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
			$x += $width
			Return 9
		Else
			$x += 2
			Local $pixel1[3] = [$x + 13, $y + 7, $c1], $pixel2[3] = [$x + 7, $y + 7, $c2], $pixel3[3] = [$x + 1, $y + 12, $c3]
			If boolPixelSearch($pixel1, $pixel2, $pixel3) Then
				$x += $width
				Return 9
			Else
				$x -= 1
			EndIf
		EndIf
	EndIf
	Return ""
EndFunc   ;==>getDigit

Hope you enjoy it, let me know if it is of any use.
It may also need some further testing.

I called the function from the Func RunBot() just after the resources are collected, and placed the includes in the Functions.au3 file:

COC Bot.au3
Func RunBot(), just after Collect()

VillageReport()
If _Sleep(1000) Then Return

Functions.au3 (ADD)

#include "functions\Village\VillageReport.au3"

Keep up the great work!

Feb 10, 2015#2

please give a result and screenshot.
I still can't get it 😕

Feb 10, 2015#3

@REZTARS

From the log:
2015-02-10 01:44:22 : Village Report
2015-02-10 01:44:22 : Nr of Free Builders: 1
2015-02-10 01:44:22 : Opening Builder page to read Resources..
2015-02-10 01:44:23 : Resources: [G]: 1308770 [E]: 1268378 [D]: 81365 [GEM]: 96
2015-02-10 01:44:25 : ~~~Waiting for full army~~~

It's been running all night..

2015-02-10 08:47:30 : Village Report
2015-02-10 08:47:30 : Nr of Free Builders: 1
2015-02-10 08:47:30 : Opening Builder page to read Resources..
2015-02-10 08:47:31 : Resources: [G]: 5144780 [E]: 5752698 [D]: 92301 [GEM]: 96
2015-02-10 08:47:32 : ~~~Waiting for full army~~~

Feb 10, 2015#4

Spotted first bug myself ;-)
Free builder readout is failing, it reports 5 free when there is 0..
Will update soon, keep you posted..

Feb 10, 2015#5

Quick fix for Free Builder detection, sources updated.

Feb 10, 2015#6

Thanks for your contribution 🙂
will added this in next update

Feb 22, 2015#7

Nice Work!!! I have a problem though

Func RunBot(), just after Collect()

When I put
VillageReport()
If _Sleep(1000) Then Return
after collect()

it only run once then it doesnt give report anymore... did I miss something?

Feb 22, 2015#8

nice work my friend. Keep it up.

Got something to add?

Log in to post a reply.

Join the conversation