@@ -206,67 +206,67 @@ EndFunc ;==>txtThreads
206206; #DEBUG FUNCTION# ==============================================================================================================
207207
208208Func chkDebugClick()
209- $g_iDebugClick = (GUICtrlRead ($g_hChkDebugClick ) = $GUI_CHECKED ? 1 : 0 )
210- SetDebugLog(" DebugClick " & ($g_iDebugClick = 1 ? " enabled" : " disabled" ))
209+ $g_bDebugClick = (GUICtrlRead ($g_hChkDebugClick ) = $GUI_CHECKED )
210+ SetDebugLog(" DebugClick " & ($g_bDebugClick ? " enabled" : " disabled" ))
211211EndFunc ; ==>chkDebugClick
212212
213213Func chkDebugSetlog()
214- $g_iDebugSetlog = (GUICtrlRead ($g_hChkDebugSetlog ) = $GUI_CHECKED ? 1 : 0 )
215- SetDebugLog(" DebugSetlog " & ($g_iDebugSetlog = 1 ? " enabled" : " disabled" ))
214+ $g_bDebugSetlog = (GUICtrlRead ($g_hChkDebugSetlog ))
215+ SetDebugLog(" DebugSetlog " & ($g_bDebugSetlog ? " enabled" : " disabled" ))
216216EndFunc ; ==>chkDebugSetlog
217217
218218Func chkDebugDisableZoomout()
219- $g_iDebugDisableZoomout = (GUICtrlRead ($g_hChkDebugDisableZoomout ) = $GUI_CHECKED ? 1 : 0 )
220- SetDebugLog(" DebugDisableZoomout " & ($g_iDebugDisableZoomout = 1 ? " enabled" : " disabled" ))
219+ $g_bDebugDisableZoomout = (GUICtrlRead ($g_hChkDebugDisableZoomout ) = $GUI_CHECKED )
220+ SetDebugLog(" DebugDisableZoomout " & ($g_bDebugDisableZoomout ? " enabled" : " disabled" ))
221221EndFunc ; ==>chkDebugDisableZoomout
222222
223223Func chkDebugDisableVillageCentering()
224- $g_iDebugDisableVillageCentering = (GUICtrlRead ($g_hChkDebugDisableVillageCentering ) = $GUI_CHECKED ? 1 : 0 )
225- SetDebugLog(" DebugDisableVillageCentering " & ($g_iDebugDisableVillageCentering = 1 ? " enabled" : " disabled" ))
224+ $g_bDebugDisableVillageCentering = (GUICtrlRead ($g_hChkDebugDisableVillageCentering ) = $GUI_CHECKED )
225+ SetDebugLog(" DebugDisableVillageCentering " & ($g_bDebugDisableVillageCentering ? " enabled" : " disabled" ))
226226EndFunc ; ==>chkDebugDisableVillageCentering
227227
228228Func chkDebugDeadbaseImage()
229- $g_iDebugDeadBaseImage = (GUICtrlRead ($g_hChkDebugDeadbaseImage ) = $GUI_CHECKED ? 1 : 0 )
230- SetDebugLog(" DebugDeadbaseImage " & ($g_iDebugDeadBaseImage = 1 ? " enabled" : " disabled" ))
229+ $g_bDebugDeadBaseImage = (GUICtrlRead ($g_hChkDebugDeadbaseImage ) = $GUI_CHECKED )
230+ SetDebugLog(" DebugDeadbaseImage " & ($g_bDebugDeadBaseImage ? " enabled" : " disabled" ))
231231EndFunc ; ==>chkDebugDeadbaseImage
232232
233233Func chkDebugOcr()
234- $g_iDebugOcr = (GUICtrlRead ($g_hChkDebugOCR ) = $GUI_CHECKED ? 1 : 0 )
235- SetDebugLog(" DebugOcr " & ($g_iDebugOcr = 1 ? " enabled" : " disabled" ))
234+ $g_bDebugOcr = (GUICtrlRead ($g_hChkDebugOCR ) = $GUI_CHECKED )
235+ SetDebugLog(" DebugOcr " & ($g_bDebugOcr ? " enabled" : " disabled" ))
236236EndFunc ; ==>chkDebugOcr
237237
238238Func chkDebugImageSave()
239- $g_iDebugImageSave = (GUICtrlRead ($g_hChkDebugImageSave ) = $GUI_CHECKED ? 1 : 0 )
240- SetDebugLog(" DebugImageSave " & ($g_iDebugImageSave = 1 ? " enabled" : " disabled" ))
239+ $g_bDebugImageSave = (GUICtrlRead ($g_hChkDebugImageSave ) = $GUI_CHECKED )
240+ SetDebugLog(" DebugImageSave " & ($g_bDebugImageSave ? " enabled" : " disabled" ))
241241EndFunc ; ==>chkDebugImageSave
242242
243243Func chkDebugBuildingPos()
244- $g_iDebugBuildingPos = (GUICtrlRead ($g_hChkdebugBuildingPos ) = $GUI_CHECKED ? 1 : 0 )
245- SetDebugLog(" DebugBuildingPos " & ($g_iDebugBuildingPos = 1 ? " enabled" : " disabled" ))
244+ $g_bDebugBuildingPos = (GUICtrlRead ($g_hChkdebugBuildingPos ) = $GUI_CHECKED )
245+ SetDebugLog(" DebugBuildingPos " & ($g_bDebugBuildingPos ? " enabled" : " disabled" ))
246246EndFunc ; ==>chkDebugBuildingPos
247247
248248Func chkDebugTrain()
249- $g_iDebugSetlogTrain = (GUICtrlRead ($g_hChkdebugTrain ) = $GUI_CHECKED ? 1 : 0 )
250- SetDebugLog(" DebugTrain " & ($g_iDebugSetlogTrain = 1 ? " enabled" : " disabled" ))
249+ $g_bDebugSetlogTrain = (GUICtrlRead ($g_hChkdebugTrain ) = $GUI_CHECKED )
250+ SetDebugLog(" DebugTrain " & ($g_bDebugSetlogTrain ? " enabled" : " disabled" ))
251251EndFunc ; ==>chkDebugTrain
252252
253253Func chkdebugOCRDonate()
254- $g_iDebugOCRdonate = (GUICtrlRead ($g_hChkDebugOCRDonate ) = $GUI_CHECKED ? 1 : 0 )
255- SetDebugLog(" DebugOCRDonate " & ($g_iDebugOCRdonate = 1 ? " enabled" : " disabled" ))
254+ $g_bDebugOCRdonate = (GUICtrlRead ($g_hChkDebugOCRDonate ) = $GUI_CHECKED )
255+ SetDebugLog(" DebugOCRDonate " & ($g_bDebugOCRdonate ? " enabled" : " disabled" ))
256256EndFunc ; ==>chkdebugOCRDonate
257257
258258Func chkdebugAttackCSV()
259- $g_iDebugAttackCSV = (GUICtrlRead ($g_hChkdebugAttackCSV ) = $GUI_CHECKED ? 1 : 0 )
260- SetDebugLog(" DebugAttackCSV " & ($g_iDebugAttackCSV = 1 ? " enabled" : " disabled" ))
259+ $g_bDebugAttackCSV = (GUICtrlRead ($g_hChkdebugAttackCSV ) = $GUI_CHECKED )
260+ SetDebugLog(" DebugAttackCSV " & ($g_bDebugAttackCSV ? " enabled" : " disabled" ))
261261EndFunc ; ==>chkdebugAttackCSV
262262
263263Func chkmakeIMGCSV()
264- $g_iDebugMakeIMGCSV = (GUICtrlRead ($g_hChkMakeIMGCSV ) = $GUI_CHECKED ? 1 : 0 )
265- SetDebugLog(" MakeIMGCSV " & ($g_iDebugMakeIMGCSV = 1 ? " enabled" : " disabled" ))
264+ $g_bDebugMakeIMGCSV = (GUICtrlRead ($g_hChkMakeIMGCSV ) = $GUI_CHECKED )
265+ SetDebugLog(" MakeIMGCSV " & ($g_bDebugMakeIMGCSV ? " enabled" : " disabled" ))
266266EndFunc ; ==>chkmakeIMGCSV
267267
268268Func btnTestTrain()
269- Local $currentOCR = $g_iDebugOcr
269+ Local $currentOCR = $g_bDebugOcr
270270 Local $currentRunState = $g_bRunState
271271 $g_bRunState = True
272272 BeginImageTest()
@@ -285,18 +285,18 @@ Func btnTestTrain()
285285
286286 EndImageTest()
287287
288- $g_iDebugOcr = $currentOCR
288+ $g_bDebugOcr = $currentOCR
289289 $g_bRunState = $currentRunState
290290EndFunc ; ==>btnTestTrain
291291
292292Func btnTestDonateCC()
293- Local $currentOCR = $g_iDebugOcr
293+ Local $currentOCR = $g_bDebugOcr
294294 Local $currentRunState = $g_bRunState
295- Local $currentSetlog = $g_iDebugSetlog
295+ Local $currentSetlog = $g_bDebugSetlog
296296 _GUICtrlTab_ClickTab($g_hTabMain , 0 )
297- $g_iDebugOcr = 1
297+ $g_bDebugOcr = True
298298 $g_bRunState = True
299- $g_iDebugSetlog = 1
299+ $g_bDebugSetlog = True
300300 ForceCaptureRegion()
301301 DebugImageSave(" donateCC_" )
302302
@@ -320,9 +320,9 @@ Func btnTestDonateCC()
320320 SetLog(_PadStringCenter(" Test DonateCC end " , 54 , " =" ), $COLOR_INFO )
321321 ShellExecute ($g_sProfileTempDebugPath & " donateCC_" )
322322
323- $g_iDebugOcr = $currentOCR
323+ $g_bDebugOcr = $currentOCR
324324 $g_bRunState = $currentRunState
325- $g_iDebugSetlog = $currentSetlog
325+ $g_bDebugSetlog = $currentSetlog
326326EndFunc ; ==>btnTestDonateCC
327327
328328Func btnTestRequestCC()
@@ -346,11 +346,11 @@ Func btnTestSendText()
346346EndFunc ; ==>btnTestSendText
347347
348348Func btnTestAttackBar()
349- Local $currentOCR = $g_iDebugOcr
349+ Local $currentOCR = $g_bDebugOcr
350350 Local $currentRunState = $g_bRunState
351351 _GUICtrlTab_ClickTab($g_hTabMain , 0 )
352352
353- $g_iDebugOcr = 1
353+ $g_bDebugOcr = True
354354 $g_bRunState = True
355355 ForceCaptureRegion()
356356 SetLog(_PadStringCenter(" Test Attack Bar begin (" & $g_sBotVersion & " )" , 54 , " =" ), $COLOR_INFO )
@@ -387,7 +387,7 @@ Func btnTestAttackBar()
387387 SetLog(_PadStringCenter(" Test Attack Bar end " , 54 , " =" ), $COLOR_INFO )
388388 ShellExecute ($savefolder )
389389
390- $g_iDebugOcr = $currentOCR
390+ $g_bDebugOcr = $currentOCR
391391 $g_bRunState = $currentRunState
392392EndFunc ; ==>btnTestAttackBar
393393
@@ -485,22 +485,24 @@ Func btnTestVillageSize()
485485 _CaptureRegion()
486486 _CaptureRegion2Sync()
487487
488- SetLog(" Testing GetVillageSize()" , $COLOR_INFO )
489- Local $hTimer = __TimerInit()
490- Local $village = GetVillageSize(True )
491- Local $ms = __TimerDiff($hTimer )
492- If $village = 0 Then
493- SetLog(" Village not found (" & Round ($ms , 0 ) & " ms.)" , $COLOR_WARNING )
494- Else
495- SetLog(" Village found (" & Round ($ms , 0 ) & " ms.)" , $COLOR_WARNING )
496- SetLog(" Village size: " & $village [0 ])
497- SetLog(" Village zoom level: " & $village [1 ])
498- SetLog(" Village offset x: " & $village [2 ])
499- SetLog(" Village offset y: " & $village [3 ])
500- SetLog(" Village stone " & $village [6 ] & " : " & $village [4 ] & " , " & $village [5 ])
501- SetLog(" Village tree " & $village [9 ] & " : " & $village [7 ] & " , " & $village [8 ])
502- EndIf
503-
488+ Local $a [2 ][2 ] = [[" stone" , " tree" ], [" 2stone" , " 2tree" ]]
489+ For $i = 0 To 1
490+ SetLog(" Testing GetVillageSize(True, "" " & $a [$i ][0 ] & " "" , "" " & $a [$i ][1 ] & " "" )" , $COLOR_INFO )
491+ Local $hTimer = __TimerInit()
492+ Local $village = GetVillageSize(True , $a [$i ][0 ], $a [$i ][1 ])
493+ Local $ms = __TimerDiff($hTimer )
494+ If $village = 0 Then
495+ SetLog(" Village not found (" & Round ($ms , 0 ) & " ms.)" , $COLOR_WARNING )
496+ Else
497+ SetLog(" Village found (" & Round ($ms , 0 ) & " ms.)" , $COLOR_WARNING )
498+ SetLog(" Village size: " & $village [0 ])
499+ SetLog(" Village zoom level: " & $village [1 ])
500+ SetLog(" Village offset x: " & $village [2 ])
501+ SetLog(" Village offset y: " & $village [3 ])
502+ SetLog(" Village stone " & $village [6 ] & " : " & $village [4 ] & " , " & $village [5 ])
503+ SetLog(" Village tree " & $village [9 ] & " : " & $village [7 ] & " , " & $village [8 ])
504+ EndIf
505+ Next
504506 EndImageTest()
505507
506508 $g_bRunState = $currentRunState
@@ -565,17 +567,17 @@ Func btnTestAttackCSV()
565567 BeginImageTest() ; get image for testing
566568
567569 Local $currentRunState = $g_bRunState
568- Local $currentDebugAttackCSV = $g_iDebugAttackCSV
569- Local $currentMakeIMGCSV = $g_iDebugMakeIMGCSV
570+ Local $currentDebugAttackCSV = $g_bDebugAttackCSV
571+ Local $currentMakeIMGCSV = $g_bDebugMakeIMGCSV
570572 Local $currentiMatchMode = $g_iMatchMode
571- Local $currentdebugsetlog = $g_iDebugSetlog
572- Local $currentDebugBuildingPos = $g_iDebugBuildingPos
573+ Local $currentdebugsetlog = $g_bDebugSetlog
574+ Local $currentDebugBuildingPos = $g_bDebugBuildingPos
573575
574576 $g_bRunState = True
575- $g_iDebugAttackCSV = 1
576- $g_iDebugMakeIMGCSV = 1
577- $g_iDebugSetlog = 1
578- $g_iDebugBuildingPos = 1
577+ $g_bDebugAttackCSV = True
578+ $g_bDebugMakeIMGCSV = True
579+ $g_bDebugSetlog = True
580+ $g_bDebugBuildingPos = True
579581
580582 $g_iMatchMode = $DB ; define which script to use
581583
@@ -595,11 +597,11 @@ Func btnTestAttackCSV()
595597 EndImageTest() ; clear test image handle
596598
597599 $g_bRunState = $currentRunState
598- $g_iDebugAttackCSV = $currentDebugAttackCSV
599- $g_iDebugMakeIMGCSV = $currentMakeIMGCSV
600+ $g_bDebugAttackCSV = $currentDebugAttackCSV
601+ $g_bDebugMakeIMGCSV = $currentMakeIMGCSV
600602 $g_iMatchMode = $currentiMatchMode
601- $g_iDebugSetlog = $currentdebugsetlog
602- $g_iDebugBuildingPos = $currentDebugBuildingPos
603+ $g_bDebugSetlog = $currentdebugsetlog
604+ $g_bDebugBuildingPos = $currentDebugBuildingPos
603605
604606EndFunc ; ==>btnTestAttackCSV
605607
@@ -611,11 +613,11 @@ Func btnTestGetLocationBuilding()
611613
612614 ; Store variables changed, set test values
613615 Local $currentRunState = $g_bRunState
614- Local $currentDebugBuildingPos = $g_iDebugBuildingPos
615- Local $currentdebugsetlog = $g_iDebugSetlog
616+ Local $currentDebugBuildingPos = $g_bDebugBuildingPos
617+ Local $currentdebugsetlog = $g_bDebugSetlog
616618 $g_bRunState = True
617- $g_iDebugBuildingPos = 1
618- $g_iDebugSetlog = 1
619+ $g_bDebugBuildingPos = True
620+ $g_bDebugSetlog = True
619621
620622 SearchZoomOut($aCenterEnemyVillageClickDrag , True , " btnTestAttackCSV" )
621623 ResetTHsearch()
@@ -651,8 +653,8 @@ Func btnTestGetLocationBuilding()
651653
652654 ; restore changed variables
653655 $g_bRunState = $currentRunState
654- $g_iDebugBuildingPos = $currentDebugBuildingPos
655- $g_iDebugSetlog = $currentdebugsetlog
656+ $g_bDebugBuildingPos = $currentDebugBuildingPos
657+ $g_bDebugSetlog = $currentdebugsetlog
656658
657659EndFunc ; ==>btnTestGetLocationBuilding
658660
@@ -789,7 +791,7 @@ Func btnTestGetLocationBuildingImage()
789791 _GDIPlus_BitmapDispose($EditedImage )
790792
791793 ; open image
792- If TestCapture() = True Then
794+ If TestCapture() Then
793795 ShellExecute ($filename )
794796 EndIf
795797
@@ -841,7 +843,7 @@ Func BeginImageTest($directory = $g_sProfileTempPath)
841843 Local $sImageFile = FileOpenDialog (" Select CoC screenshot to test, cancel to use live screenshot" , $directory , " Image (*.png)" , $FD_FILEMUSTEXIST , " " , $g_hFrmBot )
842844 If @error <> 0 Then
843845 SetLog(" Testing image cancelled, taking screenshot from " & $g_sAndroidEmulator , $COLOR_INFO )
844- ZoomOut()
846+ ; ZoomOut()
845847 _CaptureRegion()
846848 $hHBMP = $g_hHBitmap
847849 TestCapture($hHBMP )
@@ -891,7 +893,7 @@ Func btnTestOcrMemory()
891893 _CaptureRegion2(162 , 200 , 162 + 120 , 200 + 27 )
892894
893895 For $i = 1 To 5000
894- DllCall ($g_hLibMyBot , " str" , " ocr" , " ptr" , $g_hHBitmap2 , " str" , " coc-DonTroops" , " int" , $g_iDebugOcr )
896+ DllCall ($g_hLibMyBot , " str" , " ocr" , " ptr" , $g_hHBitmap2 , " str" , " coc-DonTroops" , " int" , $g_bDebugOcr ? 1 : 0 )
895897 ; getOcr($g_hHBitmap2, "coc-DonTroops")
896898 ; getOcrAndCapture("coc-DonTroops", 162, 200, 120, 27, True)
897899
@@ -907,3 +909,7 @@ Func btnTestWeakBase()
907909 EndImageTest()
908910 $g_bRunState = $currentRunState
909911EndFunc ; ==>btnTestWeakBase
912+
913+ Func btnTestClickAway()
914+ ClickP($aAway , 2 , 0 )
915+ EndFunc ; ==>btnTestClickAway
0 commit comments