The Bytecode Club
Log inJoin the club
Video Game Reverse Engineering

Bug v5.4.2.2.2

Started by bushido-21 · Jan 21, 2015

28 replies357,897 views
Jan 21, 2015#11

.... 5.4.2.2.2.2

Jan 21, 2015#12

Haha no, 5.4.2.2.3

Jan 22, 2015#13

Haha no, 5.4.2.2.3

@GkevinOD
Same issue with the OP, after the 6 hour brak the bot is not able to recatch the farming,
let me know if u need any details,

Best Regards

Jan 22, 2015#14

@GkevinOD

Very nice release, just some small code improvements I spotted, if you don't mind:

In Func atkAlgorithmBarch(), there's no need to call dropHeroes and dropCC in each Switch Case, just call it once at the end of the Switch

Displaying 'Waiting xx seconds before activating King/Queen' when you really have a king/queen available. Currently it displays it regardless of it.

Global $checkKPower = False
Global $checkQPower = False

In Func atkAlgorithmBarch(), replace:

If $checkKPower <> -1 Or $checkQPower <> -1 Then
  SetLog("Waiting " & $delayActivateKQ / 1000 & " seconds before activating King/Queen")
  _Sleep($delayActivateKQ)
  If $checkKPower <> -1 Then
    SetLog("Activate King's power")
    Click(68 + (72 * $checkKPower), 595)
  EndIf
  If $checkQPower <> -1 Then
    SetLog("Activate Queen's power")
    Click(68 + (72 * $checkQPower), 595)
  EndIf
EndIf

With:

If $checkKPower = True Or $checkQPower = True Then
  SetLog("Waiting " & $delayActivateKQ / 1000 & " seconds before activating King/Queen")
  _Sleep($delayActivateKQ)
  If $checkKPower = True Then
    SetLog("Activate King's power")
    Click(68 + (72 * $King), 595)
  EndIf
  If $checkQPower = True Then
    SetLog("Activate Queen's power")
    Click(68 + (72 * $Queen), 595)
  EndIf
EndIf

And in Func dropHeroes($x, $y, $KingSlot = -1, $QueenSlot = -1):

$checkKPower = $KingSlot
$checkQPower = $QueenSlot

With:

$checkKPower = True
$checkQPower = True

The Func ReturnHome($TakeSS = True, $GoldChangeCheck = True) doesn't need to be changed since it is already bool false.

Also, Func RequestCC() in ControlSend("BlueStacks App Player", "", "", $TextRequest, 0) would be nice to skip if same text. Don't know how to do it (yet) in AutoIt, so no code suggestion here.

Jan 22, 2015#15

@Ph!d Well first of all, the dropping of CC troops and King and Queen differ in each switch statement. Also, if you replace $checkKPower/$checkQPower with booleans, then it would fail because those check what slot they are placed in. Next, Func ReturnHome(...) have optional parameters that enable taking screenshot of loot and checking for gold change which is not needed when we just want it to return home without taking screenshot of loot and or checking for goldchange. Finally, for Func RequestCC() in order for us to check if it is the same text, it would take more power (cpu) to check than to actually just replace the text due to the use of pixel functions.

However, we do need to fix that 'Waiting xx seconds before activating King/Queen'.

Jan 22, 2015#16

Update of 6th hr log.. working around 12-13 min recovery...

2015-01-22 12:13:12 : Zoomed Out
2015-01-22 12:13:42 : Training Troops...
2015-01-22 12:13:46 : Barrack 2 is not available
2015-01-22 12:13:48 : Barrack 3 is not available
2015-01-22 12:13:51 : Barrack 4 is not available
2015-01-22 12:13:52 : Training Troops Complete
2015-01-22 12:13:53 : Time Idle: 0 hours 6 minutes 55 seconds
2015-01-22 12:13:54 : Trying to locate Main Screen
2015-01-22 12:13:56 : Waiting for Main Screen
2015-01-22 12:19:09 : Unable to load Clash Of Clans, Restarting...
2015-01-22 12:19:26 : Waiting for Main Screen
2015-01-22 12:24:40 : Unable to load Clash Of Clans, Restarting...
2015-01-22 12:24:57 : Waiting for Main Screen
2015-01-22 12:26:10 : Main Screen Located
2015-01-22 12:26:16 : Zoomed Out
2015-01-22 12:26:46 : Training Troops...
2015-01-22 12:27:05 : Training Troops Complete

I am fine with this as i dont mind being attacked once in a while. But if you want to reduce the attack chance, can try increase the frequency of checking by reducing the sleep below. currently is every 5 min check.

Func waitMainScreen() ;Waits for main screen to popup
 SetLog("Waiting for Main Screen")
 For $i = 0 To 150 ;150*2000 = 5 Minutes
Jan 22, 2015#17

@Ph!d Well first of all, the dropping of CC troops and King and Queen differ in each switch statement.

You mean 'cause the sleep()?

Also, if you replace $checkKPower/$checkQPower with booleans, then it would fail because those check what slot they are placed in.

That's why I replaced the:

Click(68 + (72 * $checkKPower), 595)
Click(68 + (72 * $checkQPower), 595)

With:

Click(68 + (72 * $King), 595)
Click(68 + (72 * $Queen), 595)

So it knows the slot when activating the powers. I have tested the changes and it is working on my end, the 'Waiting xx seconds before activating King/Queen' message is only displayed when a hero is available.

The other way around would have been to set back to -1 value in Func ReturnHome(...) but since we already have the slot stored in the variables $King and $Queen I thought it would be better to use those values and have the checks as bool instead of having 2 * 2 values of the same (king and queen).

Next, Func ReturnHome(...) have optional parameters that enable taking screenshot of loot and checking for gold change which is not needed when we just want it to return home without taking screenshot of loot and or checking for goldchange.

Here I only meant that the $checkKPower and $checkQPower don't need to be changed cause they are already bool. Sorry if I didn't make it clear.

Finally, for Func RequestCC() in order for us to check if it is the same text, it would take more power (cpu) to check than to actually just replace the text due to the use of pixel functions.

Ok, that makes sense.

Jan 23, 2015#18

How do i run it?

Jan 23, 2015#20

Wtf?!?! i didnt say that? I've been running the bot for two weeks now

I may have to change my pass

Got something to add?

Log in to post a reply.

Join the conversation