02-26-2015, 05:21 PM
(This post was last modified: 02-26-2015, 05:23 PM by huunguyen.
Edit Reason: wrong copy paste ^.^
)
(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.replace with this code
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
While _ColorCheck(_GetPixelColor(251, 357), Hex(0x888888, 6), 20) = False
Click(218, 319,5) ;Click Lightning Spell
ExitLoop (2)
WEnd