Thread Rating:
  • 40 Vote(s) - 4.78 Average
  • 1
  • 2
  • 3
  • 4
  • 5
5.4.2.5.2 - Better Troops Deployment (LF Style), Fixed Train Troops
nicely done Smile

i've got news about the th location on the map.
i've adjusted the _ImageSearchArea function in a way that works most of the times

no background mode, it' only for foreground as i'm unable to get a non black screenshot in background mode.


Code:
Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $Tolerance)

    if $Tolerance > 0 then $findImage = "*" & $Tolerance & " " & $findImage
    If $ichkBackground = 0 Then
        $x1 += $BSPos[0]
        $y1 += $BSPos[1]
        $right += $BSPos[0]
        $bottom += $BSPos[1]
    EndIf

    If IsString($findImage) Then
      if $tolerance > 0 then
         $findImage = "*" & $tolerance & " " & $findImage
      EndIf
    EndIf

    $result = DllCall("COCBot32.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)

    ; If error exit
    If IsArray($result) Then
        If $result[0] = "0" Then Return 0
    Else
        SetLog("Error cannot check for Dead Base, Attacking...")
        Return 1
    EndIf

    ; Otherwise get the x,y location of the match and the size of the image to
    ; compute the centre of search
   $array = StringSplit($result[0],"|")
   If(UBound($array) >= 4) Then
      $x=Int(Number($array[2]))
      $y=Int(Number($array[3]))
      if $resultPosition=1 then
         $x=$x + Int(Number($array[4])/2) - $x1
         $y=$y + Int(Number($array[5])/2) - $y1
     endif
      return 1
   EndIf
EndFunc
 


Messages In This Thread
Edited bot - by saxmydix - 01-27-2015, 01:28 AM
RE: 5.4.2.2.2 - by saxmydix - 01-27-2015, 01:58 PM
RE: 5.4.2.2.2 + - by saxmydix - 01-29-2015, 06:03 PM
RE: 5.4.2.2.2 - Looking @ dropCC - by LiveToDrink - 01-30-2015, 12:55 PM
TRAIN SPEED - by kennethwut - 02-01-2015, 07:18 AM
Crash on deploying Wall Breakers - by clarkii - 02-01-2015, 07:05 AM
RE: 5.4.2.4 Safar46's Mods - - by saxmydix - 02-01-2015, 01:07 PM
RE: 5.4.2.4.1 Safar46's Mods - Better Troops Deploy, Fix Out of Sync and 4 Barracks - by indy - 02-02-2015, 01:27 AM
RE: 5.4.2.4.3 - Fix Attack Townhall - by promac - 02-03-2015, 12:12 AM
RE: 5.4.2.4.3 - by promac - 02-03-2015, 01:29 AM
RE: 5.4.2.4.3 - by promac - 02-03-2015, 01:40 AM
RE: - by promac - 02-03-2015, 03:48 AM
RE: 5.4.2.4.4 - Fixed Locate Collectors - by BoBz - 02-03-2015, 04:02 AM
RE: 5.4.2.5 - by indy - 02-03-2015, 08:36 PM
RE: 5.4.2.5 - - by indy - 02-03-2015, 09:35 PM

Forum Jump:


Users browsing this thread: 35 Guest(s)

About The Bytecode Club

We're a community focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website