The Bytecode Club - Reverse Engineering Forum
pls Help me fixed CreateSpell.au3! - Printable Version

+- The Bytecode Club - Reverse Engineering Forum (https://the.bytecode.club)
+-- Forum: Lobby (https://the.bytecode.club/forumdisplay.php?fid=1)
+--- Forum: Game Cheating, Botting & Reverse Engineering (https://the.bytecode.club/forumdisplay.php?fid=97)
+--- Thread: pls Help me fixed CreateSpell.au3! (/showthread.php?tid=1128)

Pages: 1 2


pls Help me fixed CreateSpell.au3! - mtrong - 02-26-2015

I want bot Create Spell, but it no work in new vesion... im have try fix it but can't.
now can click barrcks, but it no click spell..Sad

anyonw help me fix it,pls!!!


CreateSpell.au3

Func CreateSpell()
If _GUICtrlComboBox_GetCurSel($cmbSpell) <> 0 Then
Local $chkSpell = 0
SetLog("Creating Spells...")
While 1
For $i = 0 To 3
;If _Sleep(500) Then ExitLoop (2)

;Click(1, 1) ;Click Away

;If _Sleep(500) Then ExitLoop (2)
If $barrackPos[0] = "" Then
LocateBarrack()
SaveConfig()
If _Sleep(2000) Then Return
EndIf

SetLog("Training Troops+++...", $COLOR_BLUE)

If _Sleep(100) Then Return

ClickP($TopLeftClient) ;Click Away

If _Sleep(100) Then Return

;Click($barrackPos[$i][0], $barrackPos[$i][1]) ;Click Barrack
Click($barrackPos[0], $barrackPos[1]) ;Click Barrack

If _Sleep(600) Then ExitLoop (2)
_CaptureRegion()

Local $TrainPos = _PixelSearch(155, 603, 694, 605, Hex(0x603818, 6), 5) ;Finds Train Troops button
If IsArray($TrainPos) = False Then
SetLog("Barrack " & $i + 1 & " is not available")
If _Sleep(500) Then ExitLoop (2)
Else
Click($TrainPos[0], $TrainPos[1]) ;Click Train Troops button
If _Sleep(600) Then ExitLoop (2)
While _ColorCheck(_GetPixelColor(219, 512), Hex(0xFFFFFF, 6), 20) = False
Click(95, 333) ;Click Barrack Tab
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
$chkSpell += 1
If $chkSpell = 7 And _ColorCheck(_GetPixelColor(219, 512), Hex(0xFFFFFF, 6), 20) = False Then
SetLog("Spell Factory is not available")
ExitLoop (3)
EndIf
WEnd
_CaptureRegion()
Switch $Spell
Case 1
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(218, 319) ;Click Lightning Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 2
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(322, 319) ;Click Healing Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 3
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(433, 319) ;Click Rage Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 4
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(540, 319) ;Click Jump Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 5
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(643, 319) ;Click Freeze Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
EndSwitch
ExitLoop
EndIf
Next
If _Sleep(500) Then ExitLoop (2)
Click(1, 1, 2, 250); Click away twice with 250ms delay
SetLog("Creating Spells Complete")
ExitLoop
WEnd
EndIf
EndFunc ;CreateSpell


RE: pls Help me fixed CreateSpell.au3! - huunguyen - 02-26-2015

(02-26-2015, 12:44 PM)mtrong Wrote:  I want bot Create Spell, but it no work in new vesion... im have try fix it but can't.
now can click barrcks, but it no click spell..Sad
anyonw help me fix it,pls!!!
CreateSpell.au3
Func CreateSpell()
  If _GUICtrlComboBox_GetCurSel($cmbSpell) <> 0 Then
  Local $chkSpell = 0
SetLog("Creating Spells...")
While 1
For $i = 0 To 3
;If _Sleep(500) Then ExitLoop (2)

;Click(1, 1) ;Click Away

;If _Sleep(500) Then ExitLoop (2)
If $barrackPos[0] = "" Then
  LocateBarrack()
  SaveConfig()
If _Sleep(2000) Then Return
EndIf

SetLog("Training Troops+++...", $COLOR_BLUE)

If _Sleep(100) Then Return

ClickP($TopLeftClient) ;Click Away

If _Sleep(100) Then Return

;Click($barrackPos[$i][0], $barrackPos[$i][1]) ;Click Barrack
Click($barrackPos[0], $barrackPos[1]) ;Click Barrack

If _Sleep(600) Then ExitLoop (2)
_CaptureRegion()

Local $TrainPos = _PixelSearch(155, 603, 694, 605, Hex(0x603818, 6), 5) ;Finds Train Troops button
If IsArray($TrainPos) = False Then
SetLog("Barrack " & $i + 1 & " is not available")
If _Sleep(500) Then ExitLoop (2)
Else
Click($TrainPos[0], $TrainPos[1]) ;Click Train Troops button
If _Sleep(600) Then ExitLoop (2)
While _ColorCheck(_GetPixelColor(219, 512), Hex(0xFFFFFF, 6), 20) = False
Click(95, 333) ;Click Barrack Tab
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
$chkSpell += 1
If $chkSpell = 7 And _ColorCheck(_GetPixelColor(219, 512), Hex(0xFFFFFF, 6), 20) = False Then
SetLog("Spell Factory is not available")
ExitLoop (3)
EndIf
WEnd
_CaptureRegion()
Switch $Spell
Case 1
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(218, 319) ;Click Lightning Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 2
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(322, 319) ;Click Healing Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 3
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(433, 319) ;Click Rage Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 4
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(540, 319) ;Click Jump Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
Case 5
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(643, 319) ;Click Freeze Spell
If _Sleep(1000) Then ExitLoop (2)
_CaptureRegion()
WEnd
EndSwitch
ExitLoop
EndIf
Next
If _Sleep(500) Then ExitLoop (2)
Click(1, 1, 2, 250); Click away twice with 250ms delay
SetLog("Creating Spells Complete")
ExitLoop
WEnd
  EndIf
EndFunc ;CreateSpell Pinochio
replace with this code
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(218, 319,5) ;Click Lightning Spell
ExitLoop (2)
WEnd


RE: pls Help me fixed CreateSpell.au3! - mtrong - 02-26-2015

replace with this code
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(218, 319,5) ;Click Lightning Spell
ExitLoop (2)
WEnd
[/quote]

huunguyen. u can writer code atk Dark Elixir Storage with Lightning Spell?

same atk TH ...Smile.


RE: pls Help me fixed CreateSpell.au3! - huunguyen - 02-27-2015

Yup!
I create lighting spell and search dark elixir storage. If dark elixir > some number. I will attack it with lighting spell. I will share it but my pc is weak so that I make every thing slower. It run perfect on my PC (Lenovo t61) ^.^


RE: pls Help me fixed CreateSpell.au3! - huunguyen - 02-27-2015

Link download it
https://www.dropbox.com/s/zf4yz5cigvgxbcd/COC-Bot-5.5.1.1_Mod_Atk_DE_Storage.rar?dl=0
I fixed something:
use for weak pc. (test okie on lenovo t60)
out of sync
create lighting spell and attack dark storage if de > 350
search deadbase if it is not deadbase but it has enought resource and th = 4-6 or 7 attack it (because my th = 8 ^.^)
fixed checkfullarmy = true (delete remain troops and create it again. create gaint and wb first...)
change drophero first ^.^ gaint - bar - arc - wb - bar-arc...


RE: pls Help me fixed CreateSpell.au3! - nhoc_ly - 02-27-2015

Huunguyen , Can you made in version 5.6.4 train spell and attack like that ?


RE: pls Help me fixed CreateSpell.au3! - scaarx - 02-27-2015




RE: pls Help me fixed CreateSpell.au3! - mtrong - 02-27-2015




RE: pls Help me fixed CreateSpell.au3! - huunguyen - 02-27-2015

find it in C:\COC-Bot-5.5.1.1\COCBot\functions\Attack\Attack Algorithms
if using algorithm_Barch.au3 you can add Attack Algorithms
$LSpell = -1
For $i = 0 To 8
If $atkTroops[$i][0] = $eBarbarian Then
$Barb = $i
ElseIf $atkTroops[$i][0] = $eArcher Then
$Arch = $i
ElseIf $atkTroops[$i][0] = $eCastle Then
$CC = $i
ElseIf $atkTroops[$i][0] = $eKing Then
$King = $i
ElseIf $atkTroops[$i][0] = $eQueen Then
$Queen = $i
ElseIf $atkTroops[$i][0] = $eLSpell Then
$LSpell = $i
EndIf
Next
;attack dark storage with lighting spell here
If(($DarkElixLocation = 1) And ($LSpell <> -1 And $DarkElixx <> 0)) Then
Click(68 + (72 * $LSpell), 595) ;Select Troop
If _Sleep(500) Then Return
Click($DarkElixx, $DarkElixy, 2)
EndIf


RE: pls Help me fixed CreateSpell.au3! - huunguyen - 02-27-2015

(02-27-2015, 10:10 AM)scaarx Wrote:  @huunguyen

i want to remove the spell for the DE storage because the detection is kinda slow.
Can u tell me which line i need to delete? Because  i want to try the the bully mode,

using hungle's mod or tbc's mod. if your pc is strong. all this mod work good

in root/COC Bot.au3
delete code
TrainSpell()
If _Sleep(1000) Then ExitLoop

and in root/COCBot/functions/Search/GetResources.au3

_Sleep(1000)
$DarkElixLocation = checkDarkElix()

If($searchDark < 350) Then
$DarkElixLocation = 0
$DarkElixx = 0
$DarkElixy = 0
EndIf

But i think that you should download tbc's mod. It work good everything. I only add something from this mod because i need more darkelixir.
cheers! ^.^