The Bytecode Club
Log inJoin the club
Video Game Reverse Engineering

๐ŸŒˆ pls Help me fixed CreateSpell.au3!

Started by mtrong ยท Feb 26, 2015

17 replies248,890 views
Feb 26, 2015#1

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..๐Ÿ™

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

Feb 26, 2015#2

๐Ÿ˜›

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..๐Ÿ™
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 ๐Ÿคฅ

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

Feb 26, 2015#3

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

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

same atk TH ...๐Ÿ™‚.

Feb 26, 2015#4

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) ^.^

Feb 26, 2015#5

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...

Feb 26, 2015#6

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

Feb 27, 2015#7

@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,

Feb 27, 2015#8

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...

ok. im will test it in computer me...๐Ÿ™‚. thanks. huunguyen try mod vesion 5.6.4.
want make more troop training ^^...

@huunguyen ...
im no see option create Lightning Spell other spell and option attack dark storage....
U change where in code @@

Gui:
[]. attack lightning spell dark storage.
Create Spell: [lightning]
[heat ]
[............]

Feb 27, 2015#9

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

Feb 27, 2015#10

@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! ^.^

Got something to add?

Log in to post a reply.

Join the conversation