Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Game of War - GoW - Script Update


  • Please log in to reply
5 replies to this topic
Ragjr2003
  • Members
  • 9 posts
  • Last active: Oct 25 2015 03:01 PM
  • Joined: 06 Oct 2015

First of all I would like to give all honors of this to Malechite who seems to have gone inactive....

 

This is just an attempt to resurrect the great work that he has put into this script and although I am new, I am willing to learn and try and fix this script back to its original manor when it was working so great!

 

The First few things that I am going to do is remove some of the complexity of the script and remove some of the unneeded features such as;

 

City Shield

Upgrade buildings

Heal Troops

Train Troops

Open Chests

Combine

Mass Move to Alliance

 

The Finished script will have the following;

 

Quest Collection (Daily, Alliance, Vip)

Secret Gift Collection

Athena Gift Collection

Alliance Secret Gift Collection

Alliance Helps (Help All)

Fast Help feature

Donate Resources (Alliance or Player city)

Alliance gift Collection

Donate Resoruces (# of trips / Resource Types)

 

As well as this script I will be making small "Tools" and having each individual script broken down so that people can use them as needed

;GoW Automation Part 1 of 3
 
;This is an updated automation script written for Game of War (GoW) using the Droid4X simulator.
;Cycles up to 60 accounts (easily scalable) through the following:
;Quest completion/collection, Alliance Gift Collection, Secret Gift collection, Athena Gift Collection
;Alliance Helps.  Gives an option for fast help that only collects Athena Gifts, and Alliance Helps.
;Optional cycle functions include:
;Shield City, Upgrade Buildings, Donate Resources (Alliance City or Player City), Heal Hospitalized
;Troops, Train Troops.
;Additional functions: 
;Open Chests, Combine, Donate Resources (Number of trips, and resource type), Mass move cities to
,another alliance, Many thanks to all of the people that have given me inputs to fix some of the
;minor glitches they found, and to the community forums that gave me enough to make this work.
 
If not A_IsAdmin
{
DLLCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath, str, """" .A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
ExitApp
}
 
#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 200
Gui 1:+AlwaysOnTop
 
;Adjustable Variables
 
Droid4XFileLocation = "C:\Program Files (x86)\Droid4X\Droid4X.exe"
 
;GuiLocation = x100
;GuiLocation = x1280
GuiLocation = x1590
 
DonateAll = 0
 
;Username and Password Variables
 
Login1 = [email protected]<script data-cfhash='f9e31' type="text/javascript">
/*  */</script>
pwd1 = password
Login2 = unused
pwd2 = 
Login3 = unused
pwd3 = 
Login4 = unused
pwd4 = 
Login5 = unused
pwd5 = 
Login6 = unused
pwd6 = 
Login7 = unused
pwd7 = 
Login8 = unused
pwd8 = 
Login9 = unused
pwd9 = 
Login10 = unused
pwd10 = 
Login11 = unused
pwd11 = 
Login12 = unused
pwd12 = 
Login13 = unused
pwd13 = 
Login14 = unused
pwd14 = 
Login15 = unused
pwd15 = 
Login16 = unused
pwd16 = 
Login17 = unused
pwd17 = 
Login18 = unused
pwd18 = 
Login19 = unused
pwd19 = 
Login20 = unused
pwd20 = 
Login21 = unused
pwd21 = 
Login22 = unused
pwd22 = 
Login23 = unused
pwd23 = 
Login24 = unused
pwd24 = 
Login25 = unused
pwd25 = 
Login26 = [email protected]
/*  */
pwd26 = 
Login27 = unused
pwd27 = 
Login28 = unused
pwd28 = 
Login29 = unused
pwd29 = 
Login30 = unused
pwd30 = 
Login31 = unused
pwd31 = 
Login32 = unused
pwd32 = 
Login33 = unused
pwd33 = 
Login34 = unused
pwd34 = 
Login35 = unused
pwd35 = 
Login36 = unused
pwd36 = 
Login37 = unused
pwd37 = 
Login38 = unused
pwd38 = 
Login39 = unused
pwd39 = 
Login40 = unused
pwd40 = 
Login41 = unused
pwd41 = 
Login42 = unused
pwd42 = 
Login43 = unused
pwd43 = 
Login44 = unused
pwd44 = 
Login45 = unused
pwd45 = 
Login46 = unused
pwd46 = 
Login47 = unused
pwd47 = 
Login48 = unused
pwd48 = 
Login49 = unused
pwd49 = 
Login50 = unused
pwd50 = 
Login51 = unused
pwd51 = 
Login52 = unused
pwd52 = 
Login53 = unused
pwd53 = 
Login54 = unused
pwd54 = 
Login55 = unused
pwd55 = 
Login56 = unused
pwd56 = 
Login57 = unused
pwd57 = 
Login58 = unused
pwd58 = 
Login59 = unused
pwd59 = 
Login60 = unused
pwd60 = 
 
 
;Operational Variables
 
IfWinExist, Droid4X 0.8.0 Beta
 { 
  WinActivate
  AppVer = Droid4X 0.8.0 Beta
  StartLocation = x90 y333
 }
 
IfWinExist, Droid4X 0.8.1 Beta
 {
  WinActivate
  AppVer = Droid4X 0.8.1 Beta
  StartLocation = x90 y333
 }
 
IfWinExist, Droid4X 0.8.3 Beta
 {
  WinActivate
  AppVer = Droid4X 0.8.3 Beta
  ;Icon 1 First Row
;  StartLocation = x50 y333
  ;Icon 2 First Row
;  StartLocation = x90 y333
  ;Icon 3 First Row
  StartLocation = x170 y333
 }
 
varLogin = %Login1%
vNext = %Login1%
Count = 0
Full = 0
toggle := 0
toggleS := 1
toggleW := 1
toggleM := 0
toggleP := 0
toggleL := 0
toggleA := 1
toggleVIP := 0 
toggleOC := false
toggleCm := 0
OpenChests := 0
toggleCh := false
toggleB := 1
toggleDn := 0
ToolToggle := 0
BuildMove := 0
WallCheck := 0
QuickHelps := 0
PointsEmpty = 1
ShieldAll := 0
RSSCounter := 0
MarchSlots := 0
TraidWait := 0
BuildMe := 0
ShieldMe := 0
HealMe := 0
MoveMe := 0
BeepCounter := 0
LoginFail := 0
ResearchCounter := 0
ResearchCounterSub :=0
Ry1 := 0
Rx1 := 0
RCy1 := 0
RCx1 := 0
Initial := 1
LoadWaitCounter := 0
Alliancechange = ---
AccountMode = Idle
RSSStone := 0
RSSWood := 0
RSSOre := 0
RSSFood := 0
RSSSilver := 0
RSSCounter = 0
StoneDonated = 0
WoodDonated = 0
OreDonated = 0
FoodDonated = 0
SilverDonated = 0
RSSTotal := RSSStone + RSSWood + RSSOre + RSSFood + RSSSilver
toggleTrain := 0
TroopPage := 1
TroopRow := 1
TroopLocation = x125 y350
SelectCombineTab = MaterialsMenu
 
GR1 = y110 ; %GR1%
GR2 = y135 ; %GR2%
GR3 = y175 ; %GR3%
GR4 = y205 ; %GR4%
GR5 = y215 ; %GR5%
GC1 = x10 ; %GC1%
GC2 = x40 ; %GC2%
GC3 = x220 ; %GC3%
GC4 = x250 ; %GC4%
GC5 = x430 ; %GC5%
GC6 = x460 ; %GC6%
G2R0 = y10 ; %GR0%
 
G2R1L = y31 ; 
G2R1C1 = y40
G2R1C2 = y60
G2R1L2 = y53
G2R1 = y58 ; 
 
G2R2L = y81 ; 
G2R2C1 = y90
G2R2C2 = y110
G2R2L2 = y103
G2R2 = y108 ; 
 
G2R3L = y131 ; 
G2R3C1 = y140
G2R3C2 = y160
G2R3L2 = y153
G2R3 = y158 ; 
 
G2R4L = y181 ; 
G2R4C1 = y190
G2R4C2 = y210
G2R4L2 = y203
G2R4 = y208 ; 
 
G2R5L = y231 ; 
G2R5C1 = y240
G2R5C2 = y260
G2R5L2 = y253
G2R5 = y258 ; 
 
G2R6L = y281 ; 
G2R6C1 = y290
G2R6C2 = y310
G2R6L2 = y303
G2R6 = y308 ; 
 
G2R7L = y331 ; 
G2R7C1 = y340
G2R7C2 = y360
G2R7L2 = y353
G2R7 = y358 ; 
 
G2R8L = y381 ; 
G2R8C1 = y390
G2R8C2 = y410
G2R8L2 = y403
G2R8 = y408 ; 
 
G2R9L = y431 ; 
G2R9C1 = y440
G2R9C2 = y460
G2R9L2 = y453
G2R9 = y458 ; 
 
G2C1 = x10
G2C1A = x10 ; %G2C1%
G2C1B = x35 ; %G2C1B%
G2C1C = x60 ; %G2C1C%
G2C1D = x85
G2C1E = x110
G2C1F = x135
G2C1G = x160
 
G2C2 = x85 ; %G2C2%
G2C3 = x275 ; %G2C3%
G2C3A = x275
G2C3B = x300 ; %G2C3B%
G2C3C = x325 ; %G2C3C%
G2C3D = x350
G2C3E = x375
G2C3F = x400
G2C3G = x425
 
G2C4 = x350 ; %G2C4%
G2C5 = x540 ; %G2C5%
G2C5A = x540
G2C5B = x565 ; %G2C5B%
G2C5C = x590 ; %G2C5C%
G2C5D = x615
G2C5E = x640
G2C5F = x665
G2C5G = x690
 
G2C6 = x615 ; %G2C6%
G2C7 = x680 ; %G2C7%
G2C7A = x740 ; %G2C7A%
 
 
Gui 1:Show, %GuiLocation% y190 w310 h240, GoW Mal~Ware 8.3.3, AlwaysOnTop
Gui 1:Color, B7A991
 
Gui 1:Add, Text, x10 y70 w292 0x10
Gui 1:Add, Text, x10 y100 w292 0x10
Gui 1:Add, Text, x10 y165 w292 0x10
 
Gui 1:Add, Button, x10 y10 w50 gInitialStart, Start
Gui 1:Add, Button, x79 y10 w50 gPause, Pause ;gStop, Stop
Gui 1:Add, Button, x148 y10 w50 gTools, Tools
Gui 1:Add, Button, x10 y40 w50 gNext, Next
Gui 1:Add, Button, x79 y40 w50 gReload, Reload
Gui 1:Add, Button, x148 y40 w50 gAccounts2, Options
 
Gui 1:Add, Checkbox, x10 y80 w25 vAccountS gModeChange
Gui 1:Add, Text, vAccountMode x35 y80 w65
Gui 1:Add, Text, vCurrent x100 y80 w150
 
Gui 1:Add, Button, %GR3% x10 w50 gChestToggle, Chests
Gui 1:Add, Button, %GR3% x70 w50 gCombineToggle, Combine
;Gui 1:Add, Button, %GR3% x80 w50 gRSSToggle, RSS
Gui 1:Add, Button, %GR3% x130 w50 g4GuiOpen, Donate
Gui 1:Add, Button, %GR3% x190 w50 g5GuiOpen, Train
Gui 1:Add, Checkbox, x220 y10 w25 vQuickHelps
Gui 1:Add, Text, x245 y10 w80, Fast Help
Gui 1:Add, Text, x220 y30 w90, Accounts Cycled
Gui 1:Add, Text, vCount x240 y50 w50
 
Gui 1:Add, Button, %GR2% %GC1% w50 gQuicklog, Move
Gui 1:Add, Edit, %GR2% x79 w30 vAlliance %Alliance%, abc
 
Gui 1:font, s5
;Gui 1:font, cWhite
Gui 1:Add, Text, y135 x121, Shield   Build   Donate   Heal    Train
Gui 1:font, cBlack
Gui 1:font, s8
Gui 1:Add, Checkbox, y145 x125 w25 vShieldNow
Gui 1:Add, Checkbox, y145 x150 w25 vBuildNow
Gui 1:Add, Checkbox, y145 x175 w25 vDonateNow
Gui 1:Add, Checkbox, y145 x200 w25 vHealNow
Gui 1:Add, Checkbox, y145 x225 w25 vTrainNow
 
Gui 1:Add, Text, vAllianceChange y140 x130 w90
Gui 1:Add, Button, %GR2% x250 w50 gEditHelp, Edit
 
GuiControl,,AccountMode,%AccountMode%
Gui 1:font, c422B1D
Gui 1:font, bold
Gui 1:font, s10
Gui 1:Add, Text, x10 %GR4% w290 0x10
Gui 1:Add, Radio, x10 %GR5% altsubmit gCombineTabSelect vSelectCombineTab, Cores
Gui 1:Add, Radio, x75 %GR5% altsubmit gCombineTabSelect, Pieces
Gui 1:Add, Radio, x147 %GR5% altsubmit gCombineTabSelect, Gems
Gui 1:Add, Radio, checked x212 %GR5% altsubmit gCombineTabSelect, Materials
Gui 1:font
 
Gui 2:font, s5
Gui 2:font, cBlack
Gui 2:Add, Text, %G2C1% %G2R1L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R1L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R1L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R2L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R2L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R2L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R3L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R3L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R3L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R4L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R4L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R4L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R5L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R5L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R5L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R6L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R6L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R6L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R7L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R7L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R7L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R8L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C3% %G2R8L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R8L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C1% %G2R9L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:Add, Text, %G2C5% %G2R9L%, Skip   Shield   Build   Donate   Heal    Move    Train
Gui 2:font, cBlack
Gui 2:font, s8
 
;------Gui Logins------
 
Gui 2:Add, Text, %G2C1% y75 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y75 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y75 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y125 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y125 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y125 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y175 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y175 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y175 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y225 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y225 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y225 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y275 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y275 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y275 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y325 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y325 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y325 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y375 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y375 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y375 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y425 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C3% y425 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C5% y425 w250 0x10 ;Second Row 
Gui 2:Add, Text, %G2C1% y475 w250 0x10 ;Second Row
 
Gui 2:font, bold
Gui 2:Add, Checkbox, x10 %G2R0% w25 gSAll vShieldAll
Gui 2:font, cAqua
Gui 2:Add, Text, x35 %G2R0%, Shield All
Gui 2:Add, Checkbox, x100 %G2R0% w25 gBAll vBuildAll
Gui 2:font, cNavy
Gui 2:Add, Text, x125 %G2R0%, Build All
Gui 2:Add, Checkbox, x190 %G2R0% w25 gHAll vHealAll
Gui 2:font, cLime
Gui 2:Add, Text, x215 %G2R0%, Heal All
Gui 2:Add, Checkbox, x280 %G2R0% w25 gMAll vMoveAll
Gui 2:font, cWhite
Gui 2:Add, Text, x305 %G2R0%, Move All
Gui 2:Add, Checkbox, x370 %G2R0% w25 gTAll vTrainAll
Gui 2:font, cMaroon
Gui 2:Add, Text, x395 %G2R0%, Train All
Gui 2:Add, Checkbox, x460 %G2R0% w25 gDAll vDonateAll
Gui 2:font, cBlue
Gui 2:Add, Text, x485 %G2R0%, Donate All
Gui 2:font, cMaroon
Gui 2:Add, Checkbox, checked x565 %G2R0% w25 vNoAutoRestart
Gui 2:Add, Text, x590 %G2R0% w130, Disable Auto Restart
 
Gui 2:font, cBlack
Gui 2:Add, Text, x275 y443 w53, Min Wait
Gui 2:Add, Text, x370 y443 w53, Max Wait
Gui 2:font
Gui 2:Add, Edit, x328 y439 w35 vRandomSleepMin %RandomSleepMin%, 2000
Gui 2:Add, Edit, x428 y439 w35 vRandomSleepMax %RandomSleepMax%, 4000
 
;Gui 2:Add, Checkbox, x350 y453 vAccountQ 
;Gui 2:Add, Button, x375 y448 w50 gQuests, Quest
 
Gui 2:Add, Checkbox, %G2C1A% %G2R1C1% w25 vSkipAccount1
Gui 2:Add, Checkbox, %G2C3A% %G2R1C1% w25 vSkipAccount2
Gui 2:Add, Checkbox, %G2C5A% %G2R1C1% w25 vSkipAccount3
Gui 2:Add, Checkbox, %G2C1A% %G2R2C1% w25 vSkipAccount4
Gui 2:Add, Checkbox, %G2C3A% %G2R2C1% w25 vSkipAccount5
Gui 2:Add, Checkbox, %G2C5A% %G2R2C1% w25 vSkipAccount6
Gui 2:Add, Checkbox, %G2C1A% %G2R3C1% w25 vSkipAccount7
Gui 2:Add, Checkbox, %G2C3A% %G2R3C1% w25 vSkipAccount8
Gui 2:Add, Checkbox,%G2C5A% %G2R3C1% w25 vSkipAccount9
Gui 2:Add, Checkbox,%G2C1A% %G2R4C1% w25 vSkipAccount10
Gui 2:Add, Checkbox, %G2C3A% %G2R4C1% w25 vSkipAccount11
Gui 2:Add, Checkbox, %G2C5A% %G2R4C1% w25 vSkipAccount12
Gui 2:Add, Checkbox, %G2C1A% %G2R5C1% w25 vSkipAccount13
Gui 2:Add, Checkbox, %G2C3A% %G2R5C1% w25 vSkipAccount14
Gui 2:Add, Checkbox, %G2C5A% %G2R5C1% w25 vSkipAccount15
Gui 2:Add, Checkbox, %G2C1A% %G2R6C1% w25 vSkipAccount16
Gui 2:Add, Checkbox, %G2C3A% %G2R6C1% w25 vSkipAccount17
Gui 2:Add, Checkbox, %G2C5A% %G2R6C1% w25 vSkipAccount18
Gui 2:Add, Checkbox, %G2C1A% %G2R7C1% w25 vSkipAccount19
Gui 2:Add, Checkbox, %G2C3A% %G2R7C1% w25 vSkipAccount20
Gui 2:Add, Checkbox, %G2C5A% %G2R7C1% w25 vSkipAccount21
Gui 2:Add, Checkbox, %G2C1A% %G2R8C1% w25 vSkipAccount22
Gui 2:Add, Checkbox, %G2C3A% %G2R8C1% w25 vSkipAccount23
Gui 2:Add, Checkbox, %G2C5A% %G2R8C1% w25 vSkipAccount24
Gui 2:Add, Checkbox, %G2C1A% %G2R9C1% w25 vSkipAccount25
Gui 2:Add, Checkbox, %G2C5A% %G2R9C1% w25 vSkipAccount26
 
Gui 2:Add, Checkbox, %G2C1B% %G2R1C1% w25 vShield1
Gui 2:Add, Checkbox, %G2C3B% %G2R1C1% w25 vShield2
Gui 2:Add, Checkbox, %G2C5B% %G2R1C1% w25 vShield3
Gui 2:Add, Checkbox, %G2C1B% %G2R2C1% w25 vShield4
Gui 2:Add, Checkbox, %G2C3B% %G2R2C1% w25 vShield5
Gui 2:Add, Checkbox, %G2C5B% %G2R2C1% w25 vShield6
Gui 2:Add, Checkbox, %G2C1B% %G2R3C1% w25 vShield7
Gui 2:Add, Checkbox, %G2C3B% %G2R3C1% w25 vShield8
Gui 2:Add, Checkbox, %G2C5B% %G2R3C1% w25 vShield9
Gui 2:Add, Checkbox, %G2C1B% %G2R4C1% w25 vShield10
Gui 2:Add, Checkbox, %G2C3B% %G2R4C1% w25 vShield11
Gui 2:Add, Checkbox, %G2C5B% %G2R4C1% w25 vShield12
Gui 2:Add, Checkbox, %G2C1B% %G2R5C1% w25 vShield13
Gui 2:Add, Checkbox, %G2C3B% %G2R5C1% w25 vShield14
Gui 2:Add, Checkbox, %G2C5B% %G2R5C1% w25 vShield15
Gui 2:Add, Checkbox, %G2C1B% %G2R6C1% w25 vShield16
Gui 2:Add, Checkbox, %G2C3B% %G2R6C1% w25 vShield17
Gui 2:Add, Checkbox, %G2C5B% %G2R6C1% w25 vShield18
Gui 2:Add, Checkbox, %G2C1B% %G2R7C1% w25 vShield19
Gui 2:Add, Checkbox, %G2C3B% %G2R7C1% w25 vShield20
Gui 2:Add, Checkbox, %G2C5B% %G2R7C1% w25 vShield21
Gui 2:Add, Checkbox, %G2C1B% %G2R8C1% w25 vShield22
Gui 2:Add, Checkbox, %G2C3B% %G2R8C1% w25 vShield23
Gui 2:Add, Checkbox, %G2C5B% %G2R8C1% w25 vShield24
Gui 2:Add, Checkbox, %G2C1B% %G2R9C1% w25 vShield25
Gui 2:Add, Checkbox, %G2C5B% %G2R9C1% w25 vShield26
 
Gui 2:Add, Checkbox, %G2C1C% %G2R1C1% w25 vBuild1
Gui 2:Add, Checkbox, %G2C3C% %G2R1C1% w25 vBuild2
Gui 2:Add, Checkbox, %G2C5C% %G2R1C1% w25 vBuild3
Gui 2:Add, Checkbox, %G2C1C% %G2R2C1% w25 vBuild4
Gui 2:Add, Checkbox, %G2C3C% %G2R2C1% w25 vBuild5
Gui 2:Add, Checkbox, %G2C5C% %G2R2C1% w25 vBuild6
Gui 2:Add, Checkbox, %G2C1C% %G2R3C1% w25 vBuild7
Gui 2:Add, Checkbox, %G2C3C% %G2R3C1% w25 vBuild8
Gui 2:Add, Checkbox, %G2C5C% %G2R3C1% w25 vBuild9
Gui 2:Add, Checkbox, %G2C1C% %G2R4C1% w25 vBuild10
Gui 2:Add, Checkbox, %G2C3C% %G2R4C1% w25 vBuild11
Gui 2:Add, Checkbox, %G2C5C% %G2R4C1% w25 vBuild12
Gui 2:Add, Checkbox, %G2C1C% %G2R5C1% w25 vBuild13
Gui 2:Add, Checkbox, %G2C3C% %G2R5C1% w25 vBuild14
Gui 2:Add, Checkbox, %G2C5C% %G2R5C1% w25 vBuild15
Gui 2:Add, Checkbox, %G2C1C% %G2R6C1% w25 vBuild16
Gui 2:Add, Checkbox, %G2C3C% %G2R6C1% w25 vBuild17
Gui 2:Add, Checkbox, %G2C5C% %G2R6C1% w25 vBuild18
Gui 2:Add, Checkbox, %G2C1C% %G2R7C1% w25 vBuild19
Gui 2:Add, Checkbox, %G2C3C% %G2R7C1% w25 vBuild20
Gui 2:Add, Checkbox, %G2C5C% %G2R7C1% w25 vBuild21
Gui 2:Add, Checkbox, %G2C1C% %G2R8C1% w25 vBuild22
Gui 2:Add, Checkbox, %G2C3C% %G2R8C1% w25 vBuild23
Gui 2:Add, Checkbox, %G2C5C% %G2R8C1% w25 vBuild24
Gui 2:Add, Checkbox, %G2C1C% %G2R9C1% w25 vBuild25
Gui 2:Add, Checkbox, %G2C5C% %G2R9C1% w25 vBuild26
 
Gui 2:Add, Checkbox, %G2C1D% %G2R1C1% w25 vDonate1
Gui 2:Add, Checkbox, %G2C3D% %G2R1C1% w25 vDonate2
Gui 2:Add, Checkbox, %G2C5D% %G2R1C1% w25 vDonate3
Gui 2:Add, Checkbox, %G2C1D% %G2R2C1% w25 vDonate4
Gui 2:Add, Checkbox, %G2C3D% %G2R2C1% w25 vDonate5
Gui 2:Add, Checkbox, %G2C5D% %G2R2C1% w25 vDonate6
Gui 2:Add, Checkbox, %G2C1D% %G2R3C1% w25 vDonate7
Gui 2:Add, Checkbox, %G2C3D% %G2R3C1% w25 vDonate8
Gui 2:Add, Checkbox, %G2C5D% %G2R3C1% w25 vDonate9
Gui 2:Add, Checkbox, %G2C1D% %G2R4C1% w25 vDonate10
Gui 2:Add, Checkbox, %G2C3D% %G2R4C1% w25 vDonate11
Gui 2:Add, Checkbox, %G2C5D% %G2R4C1% w25 vDonate12
Gui 2:Add, Checkbox, %G2C1D% %G2R5C1% w25 vDonate13
Gui 2:Add, Checkbox, %G2C3D% %G2R5C1% w25 vDonate14
Gui 2:Add, Checkbox, %G2C5D% %G2R5C1% w25 vDonate15
Gui 2:Add, Checkbox, %G2C1D% %G2R6C1% w25 vDonate16
Gui 2:Add, Checkbox, %G2C3D% %G2R6C1% w25 vDonate17
Gui 2:Add, Checkbox, %G2C5D% %G2R6C1% w25 vDonate18
Gui 2:Add, Checkbox, %G2C1D% %G2R7C1% w25 vDonate19
Gui 2:Add, Checkbox, %G2C3D% %G2R7C1% w25 vDonate20
Gui 2:Add, Checkbox, %G2C5D% %G2R7C1% w25 vDonate21
Gui 2:Add, Checkbox, %G2C1D% %G2R8C1% w25 vDonate22
Gui 2:Add, Checkbox, %G2C3D% %G2R8C1% w25 vDonate23
Gui 2:Add, Checkbox, %G2C5D% %G2R8C1% w25 vDonate24
Gui 2:Add, Checkbox, %G2C1D% %G2R9C1% w25 vDonate25
Gui 2:Add, Checkbox, %G2C5D% %G2R9C1% w25 vDonate26
 
Gui 2:Add, Checkbox, %G2C1E% %G2R1C1% w25 vHeal1
Gui 2:Add, Checkbox, %G2C3E% %G2R1C1% w25 vHeal2
Gui 2:Add, Checkbox, %G2C5E% %G2R1C1% w25 vHeal3
Gui 2:Add, Checkbox, %G2C1E% %G2R2C1% w25 vHeal4
Gui 2:Add, Checkbox, %G2C3E% %G2R2C1% w25 vHeal5
Gui 2:Add, Checkbox, %G2C5E% %G2R2C1% w25 vHeal6
Gui 2:Add, Checkbox, %G2C1E% %G2R3C1% w25 vHeal7
Gui 2:Add, Checkbox, %G2C3E% %G2R3C1% w25 vHeal8
Gui 2:Add, Checkbox, %G2C5E% %G2R3C1% w25 vHeal9
Gui 2:Add, Checkbox, %G2C1E% %G2R4C1% w25 vHeal10
Gui 2:Add, Checkbox, %G2C3E% %G2R4C1% w25 vHeal11
Gui 2:Add, Checkbox, %G2C5E% %G2R4C1% w25 vHeal12
Gui 2:Add, Checkbox, %G2C1E% %G2R5C1% w25 vHeal13
Gui 2:Add, Checkbox, %G2C3E% %G2R5C1% w25 vHeal14
Gui 2:Add, Checkbox, %G2C5E% %G2R5C1% w25 vHeal15
Gui 2:Add, Checkbox, %G2C1E% %G2R6C1% w25 vHeal16
Gui 2:Add, Checkbox, %G2C3E% %G2R6C1% w25 vHeal17
Gui 2:Add, Checkbox, %G2C5E% %G2R6C1% w25 vHeal18
Gui 2:Add, Checkbox, %G2C1E% %G2R7C1% w25 vHeal19
Gui 2:Add, Checkbox, %G2C3E% %G2R7C1% w25 vHeal20
Gui 2:Add, Checkbox, %G2C5E% %G2R7C1% w25 vHeal21
Gui 2:Add, Checkbox, %G2C1E% %G2R8C1% w25 vHeal22
Gui 2:Add, Checkbox, %G2C3E% %G2R8C1% w25 vHeal23
Gui 2:Add, Checkbox, %G2C5E% %G2R8C1% w25 vHeal24
Gui 2:Add, Checkbox, %G2C1E% %G2R9C1% w25 vHeal25
Gui 2:Add, Checkbox, %G2C5E% %G2R9C1% w25 vHeal26
 
Gui 2:Add, Checkbox, %G2C1F% %G2R1C1% w25 vMove1
Gui 2:Add, Checkbox, %G2C3F% %G2R1C1% w25 vMove2
Gui 2:Add, Checkbox, %G2C5F% %G2R1C1% w25 vMove3
Gui 2:Add, Checkbox, %G2C1F% %G2R2C1% w25 vMove4
Gui 2:Add, Checkbox, %G2C3F% %G2R2C1% w25 vMove5
Gui 2:Add, Checkbox, %G2C5F% %G2R2C1% w25 vMove6
Gui 2:Add, Checkbox, %G2C1F% %G2R3C1% w25 vMove7
Gui 2:Add, Checkbox, %G2C3F% %G2R3C1% w25 vMove8
Gui 2:Add, Checkbox, %G2C5F% %G2R3C1% w25 vMove9
Gui 2:Add, Checkbox, %G2C1F% %G2R4C1% w25 vMove10
Gui 2:Add, Checkbox, %G2C3F% %G2R4C1% w25 vMove11
Gui 2:Add, Checkbox, %G2C5F% %G2R4C1% w25 vMove12
Gui 2:Add, Checkbox, %G2C1F% %G2R5C1% w25 vMove13
Gui 2:Add, Checkbox, %G2C3F% %G2R5C1% w25 vMove14
Gui 2:Add, Checkbox, %G2C5F% %G2R5C1% w25 vMove15
Gui 2:Add, Checkbox, %G2C1F% %G2R6C1% w25 vMove16
Gui 2:Add, Checkbox, %G2C3F% %G2R6C1% w25 vMove17
Gui 2:Add, Checkbox, %G2C5F% %G2R6C1% w25 vMove18
Gui 2:Add, Checkbox, %G2C1F% %G2R7C1% w25 vMove19
Gui 2:Add, Checkbox, %G2C3F% %G2R7C1% w25 vMove20
Gui 2:Add, Checkbox, %G2C5F% %G2R7C1% w25 vMove21
Gui 2:Add, Checkbox, %G2C1F% %G2R8C1% w25 vMove22
Gui 2:Add, Checkbox, %G2C3F% %G2R8C1% w25 vMove23
Gui 2:Add, Checkbox, %G2C5F% %G2R8C1% w25 vMove24
Gui 2:Add, Checkbox, %G2C1F% %G2R9C1% w25 vMove25
Gui 2:Add, Checkbox, %G2C5F% %G2R9C1% w25 vMove26
 
Gui 2:Add, Checkbox, %G2C1G% %G2R1C1% w25 vTrain1
Gui 2:Add, Checkbox, %G2C3G% %G2R1C1% w25 vTrain2
Gui 2:Add, Checkbox, %G2C5G% %G2R1C1% w25 vTrain3
Gui 2:Add, Checkbox, %G2C1G% %G2R2C1% w25 vTrain4
Gui 2:Add, Checkbox, %G2C3G% %G2R2C1% w25 vTrain5
Gui 2:Add, Checkbox, %G2C5G% %G2R2C1% w25 vTrain6
Gui 2:Add, Checkbox, %G2C1G% %G2R3C1% w25 vTrain7
Gui 2:Add, Checkbox, %G2C3G% %G2R3C1% w25 vTrain8
Gui 2:Add, Checkbox, %G2C5G% %G2R3C1% w25 vTrain9
Gui 2:Add, Checkbox, %G2C1G% %G2R4C1% w25 vTrain10
Gui 2:Add, Checkbox, %G2C3G% %G2R4C1% w25 vTrain11
Gui 2:Add, Checkbox, %G2C5G% %G2R4C1% w25 vTrain12
Gui 2:Add, Checkbox, %G2C1G% %G2R5C1% w25 vTrain13
Gui 2:Add, Checkbox, %G2C3G% %G2R5C1% w25 vTrain14
Gui 2:Add, Checkbox, %G2C5G% %G2R5C1% w25 vTrain15
Gui 2:Add, Checkbox, %G2C1G% %G2R6C1% w25 vTrain16
Gui 2:Add, Checkbox, %G2C3G% %G2R6C1% w25 vTrain17
Gui 2:Add, Checkbox, %G2C5G% %G2R6C1% w25 vTrain18
Gui 2:Add, Checkbox, %G2C1G% %G2R7C1% w25 vTrain19
Gui 2:Add, Checkbox, %G2C3G% %G2R7C1% w25 vTrain20
Gui 2:Add, Checkbox, %G2C5G% %G2R7C1% w25 vTrain21
Gui 2:Add, Checkbox, %G2C1G% %G2R8C1% w25 vTrain22
Gui 2:Add, Checkbox, %G2C3G% %G2R8C1% w25 vTrain23
Gui 2:Add, Checkbox, %G2C5G% %G2R8C1% w25 vTrain24
Gui 2:Add, Checkbox, %G2C1G% %G2R9C1% w25 vTrain25
Gui 2:Add, Checkbox, %G2C5G% %G2R9C1% w25 vTrain26
 
;Account Information
 
Gui 2:Add, Text, vLogin1 %G2C1% %G2R1% w180, %Login1%
Gui 2:Add, Text, vLogin2 %G2C3% %G2R1% w180, %Login2%
Gui 2:Add, Text, vLogin3 %G2C5% %G2R1% w180, %Login3%
Gui 2:Add, Text, vLogin4 %G2C1% %G2R2% w180, %Login4%
Gui 2:Add, Text, vLogin5 %G2C3% %G2R2% w180, %Login5%
Gui 2:Add, Text, vLogin6 %G2C5% %G2R2% w180, %Login6%
Gui 2:Add, Text, vLogin7 %G2C1% %G2R3% w180, %Login7%
Gui 2:Add, Text, vLogin8 %G2C3% %G2R3% w180, %Login8%
Gui 2:Add, Text, vLogin9 %G2C5% %G2R3% w180, %Login9%
Gui 2:Add, Text, vLogin10 %G2C1% %G2R4% w180, %Login10%
Gui 2:Add, Text, vLogin11 %G2C3% %G2R4% w180, %Login11%
Gui 2:Add, Text, vLogin12 %G2C5% %G2R4% w180, %Login12%
Gui 2:Add, Text, vLogin13 %G2C1% %G2R5% w180, %Login13%
Gui 2:Add, Text, vLogin14 %G2C3% %G2R5% w180, %Login14%
Gui 2:Add, Text, vLogin15 %G2C5% %G2R5% w180, %Login15%
Gui 2:Add, Text, vLogin16 %G2C1% %G2R6% w180, %Login16%
Gui 2:Add, Text, vLogin17 %G2C3% %G2R6% w180, %Login17%
Gui 2:Add, Text, vLogin18 %G2C5% %G2R6% w180, %Login18%
Gui 2:Add, Text, vLogin19 %G2C1% %G2R7% w180, %Login19%
Gui 2:Add, Text, vLogin20 %G2C3% %G2R7% w180, %Login20%
Gui 2:Add, Text, vLogin21 %G2C5% %G2R7% w180, %Login21%
Gui 2:Add, Text, vLogin22 %G2C1% %G2R8% w180, %Login22%
Gui 2:Add, Text, vLogin23 %G2C3% %G2R8% w180, %Login23%
Gui 2:Add, Text, vLogin24 %G2C5% %G2R8% w180, %Login24%
Gui 2:Add, Text, vLogin25 %G2C1% %G2R9% w180, %Login25%
 
Gui 2:Add, Button, %G2C7A% %G2R0% w50 gSaveOptions, Done
 
Gui 1:Submit, nohide
 
DDLLogins =
(Join|
%Login1%|
%Login2%
%Login3%
%Login4%
%Login5%
%Login6%
%Login7%
%Login8%
%Login9%
%Login10%
%Login11%
%Login12%
%Login13%
%Login14%
%Login15%
%Login16%
%Login17%
%Login18%
%Login19%
%Login20%
%Login21%
%Login22%
%Login23%
%Login24%
%Login25%
%Login26%
%Login27%
%Login28%
%Login29%
%Login30%
%Login31%
%Login32%
%Login33%
%Login34%
%Login35%
%Login36%
%Login37%
%Login38%
%Login39%
%Login40%
%Login41%
%Login42%
%Login43%
%Login44%
%Login45%
%Login46%
%Login47%
%Login48%
%Login49%
%Login50%
%Login51%
%Login52%
%Login53%
%Login54%
%Login55%
%Login56%
%Login57%
%Login58%
%Login59%
%Login60%
)
 
DDL2Logins =
(Join|
%Login26%|
%Login27%
%Login28%
%Login29%
%Login30%
%Login31%
%Login32%
%Login33%
%Login34%
%Login35%
%Login36%
%Login37%
%Login38%
%Login39%
%Login40%
%Login41%
%Login42%
%Login43%
%Login44%
%Login45%
%Login46%
%Login47%
%Login48%
%Login49%
%Login50%
%Login51%
%Login52%
%Login53%
%Login54%
%Login55%
%Login56%
%Login57%
%Login58%
%Login59%
%Login60%
)
Gui 2:Submit, nohide
Gui 1:Submit, NoHide
 
Gui 1:Add, DropDownList, %GR1% x79 w222 vLoginSelect, %DDLLogins%
Gui 2:Add, DropDownList, %G2C5% %G2R9% w180 vLoginSelect2, %DDL2Logins%
Gui 1:Add, Button, %GR1% %GC1% w50 gQuickLog, Login
 
Gui 3:Add, Button, x10 y10 w50 gPixel, Pixel
Gui 3:Add, Button, x70 y10 w50 gPause, Pause
Gui 3:Add, Button, x130 y10 w50 gResize, Resize
Gui 3:Add, Button, x190 y10 w50 gReload, Reload
Gui 3:Add, Button, x250 y10 w50 gToolsClose, Close
 
Gui 3:font, s10
Gui 3:font, bold
Gui 3:Add, Text, x10 y43, X
Gui 3:Add, Text, x73 y43, Y
Gui 3:font
Gui 3:font, s8
Gui 3:Add, Button, x130 y40 w50 gColor, Color
Gui 3:Add, Edit, x28 y40 w30 vCXcoord %CXcoord%, 166
Gui 3:Add, Edit, x90 y40 w30 vCYcoord %CYcoord%, 282
Gui 3:Add, Text, vColorInfo x190 y45 w55
Gui 3:Add, Button, x250 y40 w50 gTest, Test
Gui 3:Submit, nohide
 
Gui 4:Add, Button, x10 y10 w50 gDonateToggle, Donate
Gui 4:Add, Button, x75 y10 w50 gSaveDonate, Done
Gui 4:font, s10
Gui 4:font, cwhite
Gui 4:Add, Text, y42 x40, Alliance City
 
Gui 4:Add, Text, y65 x10 w115 0x10
Gui 4:Add, Text, y70 x35, Player City
 
Gui 4:Add, Text, vDonationNumbers y32 x160 w65
 
Gui 4:Add, Text, y62 x135, Stone
Gui 4:Add, Text, y92 x135, Wood
Gui 4:font, caqua
Gui 4:Add, Text, y32 x225, Silver
Gui 4:font, cwhite
Gui 4:Add, Text, y62 x225, Ore
Gui 4:Add, Text, y92 x225, Food
Gui 4:font, s12
Gui 4:Add, Text, y5 x150, Donations of Each
Gui 4:font, s12
Gui 4:Add, Text, y91 x10, X
Gui 4:Add, Text, y91 x73, Y
Gui 4:font, cblack
Gui 4:font, s8
Gui 4:Add, Checkbox, checked y43 x15 w25 vDonateAC
 
Gui 4:Add, Edit, y90 x28 w30 vXcoord %Xcoord%, 451
Gui 4:Add, Edit, y90 x90 w30 vYcoord %Ycoord%, 357
Gui 4:Add, Edit, y60 x180 w20 vRSSStone %RSSStone%, 0
Gui 4:Add, Edit, y90 x180 w20 vRSSWood %RSSWood%, 0
Gui 4:Add, Edit, y30 x270 w20 vRSSSilver %RSSSilver%, 0
Gui 4:Add, Edit, y60 x270 w20 vRSSOre %RSSOre%, 0
Gui 4:Add, Edit, y90 x270 w20 vRSSFood %RSSFood%, 0
GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
 
Gui 5:Add, Button, x10 y10 w50 gTrainToggle, Train
Gui 5:Add, Button, x70 y10 w50 g5GuiClose, Done
 
Gui 5:font, s8
Gui 5:font, cNavy
Gui 5:Add, Radio, checked x10 y50 altsubmit gPickTroop vTroopType, Swordsmen
Gui 5:Add, Radio, x90 y50 altsubmit gPickTroop, Slingers
Gui 5:Add, Radio, x170 y50 altsubmit gPickTroop, Outriders
Gui 5:Add, Radio, x10 y70 altsubmit gPickTroop, Ram
Gui 5:Add, Radio, x90 y70 altsubmit gPickTroop, Hoplites
Gui 5:Add, Radio, x170 y70 altsubmit gPickTroop, Skirmish
Gui 5:Add, Radio, x10 y90 altsubmit gPickTroop, Light Cav.
Gui 5:Add, Radio, x90 y90 altsubmit gPickTroop, Ballista
Gui 5:Add, Radio, x170 y90 altsubmit gPickTroop, Pikeman
Gui 5:Add, Radio, x10 y110 altsubmit gPickTroop, Guardians
Gui 5:Add, Radio, x90 y110 altsubmit gPickTroop, Comp. Cav.
Gui 5:Add, Radio, x170 y110 altsubmit gPickTroop, Seige Twr
Gui 5:Add, Radio, x10 y130 altsubmit gPickTroop, Immortals
Gui 5:Add, Radio, x90 y130 altsubmit gPickTroop, Marksman
Gui 5:Add, Radio, x170 y130 altsubmit gPickTroop, War Eleph.
Gui 5:Add, Radio, x10 y150 altsubmit gPickTroop, Onager
Gui 5:font, cMaroon
Gui 5:Add, Radio, x10 y170 altsubmit gPickTroop, Spearmen
Gui 5:Add, Radio, x90 y170 altsubmit gPickTroop, Hunters
Gui 5:Add, Radio, x170 y170 altsubmit gPickTroop, Chariots
Gui 5:Add, Radio, x10 y190 altsubmit gPickTroop, Peltasts
Gui 5:Add, Radio, x90 y190 altsubmit gPickTroop, Rangers
Gui 5:Add, Radio, x170 y190 altsubmit gPickTroop, Scyth Char.
Gui 5:Add, Radio, x10 y210 altsubmit gPickTroop, Phalangite
Gui 5:Add, Radio, x90 y210 altsubmit gPickTroop, Stalkers
Gui 5:Add, Radio, x170 y210 altsubmit gPickTroop, Lancers
Gui 5:Add, Radio, x10 y230 altsubmit gPickTroop, Legionnaires
Gui 5:Add, Radio, x90 y230 altsubmit gPickTroop, Dianas
Gui 5:Add, Radio, x170 y230 altsubmit gPickTroop, Cataphracts
Gui 5:font, cBlack
Gui 5:Submit, nohide
 
Esc::ExitApp
 
RandomWait:
GuiControlGet, RandomSleepMin, 2:
GuiControlGet, RandomSleepMax, 2:
Random, n, %RandomSleepMin%, %RandomSleepMax%
n = %sleep%
sleep, %sleep%
return
 
RandomWait1:
Random, n, 1000, 1500
n = %sleep%
sleep, %sleep%
return
 
CheckboxSubmit:
Gui 1:Submit, nohide
Gui 2:Submit
Gui 3:Submit
return
 
DonateToggle:
If (DonateNow = 0)
 {
  DonateNow := 1
  DonateMe := 1
  goto, DonateNow
  return
 }
If (DonateNow = 1)
 {
  DonateNow := 0
  DonateMe := 0
  goto, cityscreen
  return
 }
return
 
DonateNow:
Gui 4:Submit, nohide
RSSTotal := RSSStone + RSSWood + RSSOre + RSSFood + RSSSilver
GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
goto, DonateRSS
return
 
BuildNow:
BuildMe = 1
goto, Build
return
 
SubmitLogin:
Gui 1:Submit, NoHide
vNext = %LoginSelect%
goto, Quicklog
return
 
Accounts2:
#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 100
Gui 2:Show, x10 y10 w805 h488, Mains, AlwaysOnTop
Gui 2:Color, gray
Gui 2:Submit, nohide
return
 
Tools:
#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 200
Gui 3:font, s8
Gui 3:Color, C7BFB7
Gui 3:Show, %GuiLocation% y464 w310 h75, Tools, AlwaysOnTop
ColorInfo = 0x000000
GuiControl,3:,ColorInfo,%ColorInfo%
Gui 3:Submit, nohide
return
 
4GuiOpen:
#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 100
Gui 4:Color, teal
Gui 4:font, cBlack
Gui 4:Show, %GuiLocation% y464 w310 h120, Donate, AlwaysOnTop
GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
Gui 4:Submit, nohide
return
 
5GuiOpen:
#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 100
Gui 5:Color, White
Gui 5:Submit, nohide
Gui 5:Show, %GuiLocation% y464 w250 h250, Train, AlwaysOnTop
return
 
2GuiClose:
Gui 1:-Disabled
Gui 2:Submit
Gui 2:Hide
Return
 
 
ToolsClose:
Gui 3:Submit
Gui 3:Hide
Return
 
4GuiClose:
Gui 4:Submit
Gui 4:Hide
Return
 
5GuiClose:
Gui 5:Submit
Gui 5:Hide
Return
 
SaveOptions:
Gui 1:-Disabled
Gui 2:Submit
Gui 2:Hide
return
 
SaveDonate:
Gui 4:Submit
return
 
SAll:
GuiControlGet, ShieldAll, 2:
ToggleShieldAll := !toggle
If (ShieldAll = 1)
{
 gosub, AllShieldsOn
 }
If (ShieldAll = 0)
{
gosub, AllShieldsOff
}
return
 
AllShieldsOn:
GuiControl,2:,Shield1,1
GuiControl,2:,Shield2,1
GuiControl,2:,Shield3,1
GuiControl,2:,Shield4,1
GuiControl,2:,Shield5,1
GuiControl,2:,Shield6,1
GuiControl,2:,Shield7,1
GuiControl,2:,Shield8,1
GuiControl,2:,Shield9,1
GuiControl,2:,Shield10,1
GuiControl,2:,Shield11,1
GuiControl,2:,Shield12,1
GuiControl,2:,Shield13,1
GuiControl,2:,Shield14,1
GuiControl,2:,Shield15,1
GuiControl,2:,Shield16,1
GuiControl,2:,Shield17,1
GuiControl,2:,Shield18,1
GuiControl,2:,Shield19,1
GuiControl,2:,Shield20,1
GuiControl,2:,Shield21,1
GuiControl,2:,Shield22,1
GuiControl,2:,Shield23,1
GuiControl,2:,Shield24,1
GuiControl,2:,Shield25,1
return
 
AllShieldsOff:
GuiControl,2:,Shield1,0
GuiControl,2:,Shield2,0
GuiControl,2:,Shield3,0
GuiControl,2:,Shield4,0
GuiControl,2:,Shield5,0
GuiControl,2:,Shield6,0
GuiControl,2:,Shield7,0
GuiControl,2:,Shield8,0
GuiControl,2:,Shield9,0
GuiControl,2:,Shield10,0
GuiControl,2:,Shield11,0
GuiControl,2:,Shield12,0
GuiControl,2:,Shield13,0
GuiControl,2:,Shield14,0
GuiControl,2:,Shield15,0
GuiControl,2:,Shield16,0
GuiControl,2:,Shield17,0
GuiControl,2:,Shield18,0
GuiControl,2:,Shield19,0
GuiControl,2:,Shield20,0
GuiControl,2:,Shield21,0
GuiControl,2:,Shield22,0
GuiControl,2:,Shield23,0
GuiControl,2:,Shield24,0
GuiControl,2:,Shield25,0
return
 
BAll:
GuiControlGet, BuildAll, 2:
ToggleBuildAll := !toggle
If (BuildAll = 1)
{
 gosub, AllBuildOn
 }
If (BuildAll = 0)
{
gosub, AllBuildOff
}
return
 
AllBuildOn:
GuiControl,2:,Build1,1
GuiControl,2:,Build2,1
GuiControl,2:,Build3,1
GuiControl,2:,Build4,1
GuiControl,2:,Build5,1
GuiControl,2:,Build6,1
GuiControl,2:,Build7,1
GuiControl,2:,Build8,1
GuiControl,2:,Build9,1
GuiControl,2:,Build10,1
GuiControl,2:,Build11,1
GuiControl,2:,Build12,1
GuiControl,2:,Build13,1
GuiControl,2:,Build14,1
GuiControl,2:,Build15,1
GuiControl,2:,Build16,1
GuiControl,2:,Build17,1
GuiControl,2:,Build18,1
GuiControl,2:,Build19,1
GuiControl,2:,Build20,1
GuiControl,2:,Build21,1
GuiControl,2:,Build22,1
GuiControl,2:,Build23,1
GuiControl,2:,Build24,1
GuiControl,2:,Build25,1
GuiControl,2:,Build26,1
return
 
AllBuildOff:
GuiControl,2:,Build1,0
GuiControl,2:,Build2,0
GuiControl,2:,Build3,0
GuiControl,2:,Build4,0
GuiControl,2:,Build5,0
GuiControl,2:,Build6,0
GuiControl,2:,Build7,0
GuiControl,2:,Build8,0
GuiControl,2:,Build9,0
GuiControl,2:,Build10,0
GuiControl,2:,Build11,0
GuiControl,2:,Build12,0
GuiControl,2:,Build13,0
GuiControl,2:,Build14,0
GuiControl,2:,Build15,0
GuiControl,2:,Build16,0
GuiControl,2:,Build17,0
GuiControl,2:,Build18,0
GuiControl,2:,Build19,0
GuiControl,2:,Build20,0
GuiControl,2:,Build21,0
GuiControl,2:,Build22,0
GuiControl,2:,Build23,0
GuiControl,2:,Build24,0
GuiControl,2:,Build25,0
GuiControl,2:,Build26,0
return
 
HAll:
GuiControlGet, HealAll, 2:
ToggleHealAll := !toggle
If (HealAll = 1)
{
 gosub, AllHealOn
 }
If (HealAll = 0)
{
gosub, AllHealOff
}
return
 
AllHealOn:
GuiControl,2:,Heal1,1
GuiControl,2:,Heal2,1
GuiControl,2:,Heal3,1
GuiControl,2:,Heal4,1
GuiControl,2:,Heal5,1
GuiControl,2:,Heal6,1
GuiControl,2:,Heal7,1
GuiControl,2:,Heal8,1
GuiControl,2:,Heal9,1
GuiControl,2:,Heal10,1
GuiControl,2:,Heal11,1
GuiControl,2:,Heal12,1
GuiControl,2:,Heal13,1
GuiControl,2:,Heal14,1
GuiControl,2:,Heal15,1
GuiControl,2:,Heal16,1
GuiControl,2:,Heal17,1
GuiControl,2:,Heal18,1
GuiControl,2:,Heal19,1
GuiControl,2:,Heal20,1
GuiControl,2:,Heal21,1
GuiControl,2:,Heal22,1
GuiControl,2:,Heal23,1
GuiControl,2:,Heal24,1
GuiControl,2:,Heal25,1
GuiControl,2:,Heal26,1
return
 
AllHealOff:
GuiControl,2:,Heal1,0
GuiControl,2:,Heal2,0
GuiControl,2:,Heal3,0
GuiControl,2:,Heal4,0
GuiControl,2:,Heal5,0
GuiControl,2:,Heal6,0
GuiControl,2:,Heal7,0
GuiControl,2:,Heal8,0
GuiControl,2:,Heal9,0
GuiControl,2:,Heal10,0
GuiControl,2:,Heal11,0
GuiControl,2:,Heal12,0
GuiControl,2:,Heal13,0
GuiControl,2:,Heal14,0
GuiControl,2:,Heal15,0
GuiControl,2:,Heal16,0
GuiControl,2:,Heal17,0
GuiControl,2:,Heal18,0
GuiControl,2:,Heal19,0
GuiControl,2:,Heal20,0
GuiControl,2:,Heal21,0
GuiControl,2:,Heal22,0
GuiControl,2:,Heal23,0
GuiControl,2:,Heal24,0
GuiControl,2:,Heal25,0
GuiControl,2:,Heal26,0
return
 
MAll:
GuiControlGet, MoveAll, 2:
ToggleMoveAll := !toggle
If (MoveAll = 1)
{
 gosub, AllMoveOn
 }
If (MoveAll = 0)
{
gosub, AllMoveOff
}
return
 
AllMoveOn:
GuiControl,2:,Move1,1
GuiControl,2:,Move2,1
GuiControl,2:,Move3,1
GuiControl,2:,Move4,1
GuiControl,2:,Move5,1
GuiControl,2:,Move6,1
GuiControl,2:,Move7,1
GuiControl,2:,Move8,1
GuiControl,2:,Move9,1
GuiControl,2:,Move10,1
GuiControl,2:,Move11,1
GuiControl,2:,Move12,1
GuiControl,2:,Move13,1
GuiControl,2:,Move14,1
GuiControl,2:,Move15,1
GuiControl,2:,Move16,1
GuiControl,2:,Move17,1
GuiControl,2:,Move18,1
GuiControl,2:,Move19,1
GuiControl,2:,Move20,1
GuiControl,2:,Move21,1
GuiControl,2:,Move22,1
GuiControl,2:,Move23,1
GuiControl,2:,Move24,1
GuiControl,2:,Move25,1
GuiControl,2:,Move26,1
return
 
AllMoveOff:
GuiControl,2:,Move1,0
GuiControl,2:,Move2,0
GuiControl,2:,Move3,0
GuiControl,2:,Move4,0
GuiControl,2:,Move5,0
GuiControl,2:,Move6,0
GuiControl,2:,Move7,0
GuiControl,2:,Move8,0
GuiControl,2:,Move9,0
GuiControl,2:,Move10,0
GuiControl,2:,Move11,0
GuiControl,2:,Move12,0
GuiControl,2:,Move13,0
GuiControl,2:,Move14,0
GuiControl,2:,Move15,0
GuiControl,2:,Move16,0
GuiControl,2:,Move17,0
GuiControl,2:,Move18,0
GuiControl,2:,Move19,0
GuiControl,2:,Move20,0
GuiControl,2:,Move21,0
GuiControl,2:,Move22,0
GuiControl,2:,Move23,0
GuiControl,2:,Move24,0
GuiControl,2:,Move25,0
GuiControl,2:,Move26,0
return
 
TAll:
GuiControlGet, TrainAll, 2:
ToggleTrainAll := !toggle
If (TrainAll = 1)
{
 gosub, AllTrainOn
 }
If (TrainAll = 0)
{
gosub, AllTrainOff
}
return
 
AllTrainOn:
GuiControl,2:,Train1,1
GuiControl,2:,Train2,1
GuiControl,2:,Train3,1
GuiControl,2:,Train4,1
GuiControl,2:,Train5,1
GuiControl,2:,Train6,1
GuiControl,2:,Train7,1
GuiControl,2:,Train8,1
GuiControl,2:,Train9,1
GuiControl,2:,Train10,1
GuiControl,2:,Train11,1
GuiControl,2:,Train12,1
GuiControl,2:,Train13,1
GuiControl,2:,Train14,1
GuiControl,2:,Train15,1
GuiControl,2:,Train16,1
GuiControl,2:,Train17,1
GuiControl,2:,Train18,1
GuiControl,2:,Train19,1
GuiControl,2:,Train20,1
GuiControl,2:,Train21,1
GuiControl,2:,Train22,1
GuiControl,2:,Train23,1
GuiControl,2:,Train24,1
GuiControl,2:,Train25,1
GuiControl,2:,Train26,1
return
 
AllTrainOff:
GuiControl,2:,Train1,0
GuiControl,2:,Train2,0
GuiControl,2:,Train3,0
GuiControl,2:,Train4,0
GuiControl,2:,Train5,0
GuiControl,2:,Train6,0
GuiControl,2:,Train7,0
GuiControl,2:,Train8,0
GuiControl,2:,Train9,0
GuiControl,2:,Train10,0
GuiControl,2:,Train11,0
GuiControl,2:,Train12,0
GuiControl,2:,Train13,0
GuiControl,2:,Train14,0
GuiControl,2:,Train15,0
GuiControl,2:,Train16,0
GuiControl,2:,Train17,0
GuiControl,2:,Train18,0
GuiControl,2:,Train19,0
GuiControl,2:,Train20,0
GuiControl,2:,Train21,0
GuiControl,2:,Train22,0
GuiControl,2:,Train23,0
GuiControl,2:,Train24,0
GuiControl,2:,Train25,0
GuiControl,2:,Train26,0
return
 
DAll:
;GuiControlGet, DonateAll, 2:
ToggleDonateAll := !toggle
If (DonateAll = 1)
{
 gosub, AllDonateOn
 }
If (DonateAll = 0)
{
gosub, AllDonateOff
}
return
 
AllDonateOn:
GuiControl,2:,Donate1,1
GuiControl,2:,Donate2,1
GuiControl,2:,Donate3,1
GuiControl,2:,Donate4,1
GuiControl,2:,Donate5,1
GuiControl,2:,Donate6,1
GuiControl,2:,Donate7,1
GuiControl,2:,Donate8,1
GuiControl,2:,Donate9,1
GuiControl,2:,Donate10,1
GuiControl,2:,Donate11,1
GuiControl,2:,Donate12,1
GuiControl,2:,Donate13,1
GuiControl,2:,Donate14,1
GuiControl,2:,Donate15,1
GuiControl,2:,Donate16,1
GuiControl,2:,Donate17,1
GuiControl,2:,Donate18,1
GuiControl,2:,Donate19,1
GuiControl,2:,Donate20,1
GuiControl,2:,Donate21,1
GuiControl,2:,Donate22,1
GuiControl,2:,Donate23,1
GuiControl,2:,Donate24,1
GuiControl,2:,Donate25,1
GuiControl,2:,Donate26,1
return
 
AllDonateOff:
GuiControl,2:,Donate1,0
GuiControl,2:,Donate2,0
GuiControl,2:,Donate3,0
GuiControl,2:,Donate4,0
GuiControl,2:,Donate5,0
GuiControl,2:,Donate6,0
GuiControl,2:,Donate7,0
GuiControl,2:,Donate8,0
GuiControl,2:,Donate9,0
GuiControl,2:,Donate10,0
GuiControl,2:,Donate11,0
GuiControl,2:,Donate12,0
GuiControl,2:,Donate13,0
GuiControl,2:,Donate14,0
GuiControl,2:,Donate15,0
GuiControl,2:,Donate16,0
GuiControl,2:,Donate17,0
GuiControl,2:,Donate18,0
GuiControl,2:,Donate19,0
GuiControl,2:,Donate20,0
GuiControl,2:,Donate21,0
GuiControl,2:,Donate22,0
GuiControl,2:,Donate23,0
GuiControl,2:,Donate24,0
GuiControl,2:,Donate25,0
GuiControl,2:,Donate26,0
return
 
CityScreen:
IfWinExist, %AppVer%
 WinActivate
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, resize
   sleep, 3000
   goto, CityScreen
   return
  }
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, RestartDroidFail
  }
PixelSearch, Px, Py, 78, 73, 78, 73, 0xFFFFFF, 0, Fast ;Facebook
 If ErrorLevel = 0
  {
   ControlClick, x78 y73, %AppVer%
   sleep, 3000
   goto, CityScreen
   return
  }
PixelSearch, Px, Py, 411, 79, 411, 79, 0xDCDCDC, 0, Fast ;GoW Facebook Splash
 If ErrorLevel = 0
  {
   ControlClick, x411 y79, %AppVer%
   sleep, 3000
   goto, CityScreen
   return
  }
PixelSearch, Px, Py, 220, 350, 220, 350, 0x030839, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x220 y350, %AppVer% ;City Menu
   sleep, 3000
   goto, CityScreen
   return
  }
PixelSearch, Px, Py, 200, 550, 200, 550, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x200 y550, %AppVer% ;City Menu
   sleep, 3000
   goto, CityScreen
   return
  }
PixelSearch, Px, Py, 150, 50, 150, 50, 0x101427, 50, Fast
 If ErrorLevel = 0
  {
   ControlClick, x100 y700, %AppVer% ;City Menu
   sleep, 3000
   goto, CityScreen
   return
  }
PixelSearch, Px, Py, 416, 35, 450, 58, 0xDCDCDC, 10, Fast
 If ErrorLevel = 0
  {
   ControlClick, x435 y50, %AppVer% ;Get Gold Splash Close
   sleep, 3000
   goto, CityScreen
   return
  }
return
 
SizeCheck:
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, resize
  }
return
 
MapScreen:
IfWinExist, %AppVer%
 WinActivate
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, resize
   sleep, 3000
   goto, MapScreen
   return
  }
PixelSearch, Px, Py, 150, 50, 150, 50, 0x101427, 50, Fast
 If ErrorLevel != 0
  {
   ControlClick, x100 y700, %AppVer% ;City Menu
   sleep, 3000
   goto, MapScreen
   return
  }
return
 
FullDungeonRun:
return
 
 
ModeChange:
GuiControlGet, AccountS
 If (AccountS = 1)
  {
   AccountMode = Single Account:
  } 
 If (AccountS = 0)
  {
   AccountMode = ---
  }
GuiControl,,AccountMode,%AccountMode%
return
 
Droid4X:
gosub, ShutdownDroid4X
;goto, pause
gosub, StartupDroid4X
gosub, DXUpdate
sleep, 5000
Return
 
ShutdownDroid4X:
;Process, Exist, %AppVer%
;IfExist, %AppVer%
Process,Exist, Droid4X.exe
 If ( ErrorLevel != 0 )
  {
  Process, Close, Droid4X.exe
  sleep, 3000
  Process, Close, %AppVer%
  sleep, 3000
  Process, Close, Droid4XService
  sleep, 5000
  Process, Close, Droid4X (32 bit)
  sleep, 5000
;  gosub, ShutdownDroid4X
 }
 
return
 
StartupDroid4X:
;IfWinNotExist, %AppVer%
; WinActivate
Process,Exist, Droid4X.exe
 If ( ErrorLevel = 0 )
  {
   Run %Droid4XFileLocation% ;Droid4X 0.8.3
   sleep, 30000
   goto, StartupDroid4X
  }
return
 
DXUpdate:
IfWinExist, DXUpdate
 WinActivate
Process, Close, DXUpdate.exe ;close DXUpdate
IfWinExist, DXUpdate
 {
  goto, DXUpdate
 }
return
 
GuiClose:
ExitApp
return
 
Stop:
Exit
return
 
Pause:
IfWinExist, %AppVer%
 WinActivate
Pause, Toggle, 1
return
 
Reload:
Reload
Sleep 2000
return
 
CombineToggle:
IfWinExist, %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  toggleCm := 1
  goto, BeginCombine
return
 }
If (toggleCm = 1)
 {
  toggleCm := 0
  goto, CombineDone
return
 }
 
EditHelp:
MsgBox, 4,, To use the alternate accounts edit the .ahk file to include`nyour email addresses and passwords.`nWould you like to edit accounts? (press Yes or No)
 IfMsgBox Yes
  goto, EditScript
 Else
return
 
EditScript:
RunWait,"C:\WINDOWS\system32\notepad.exe" "%A_ScriptFullPath%"
IfWinExist GoWScript.ahk - Notepad
 {
  WinActivate
 }
return
 
Change:
gosub, ChangeToggle
return
 
ChangeToggle:
toggleCh := !toggle
 If(toggleCh)
  {
   toggleCh := false
  }
 Else
  {
   toggleCh := true
   GuiControl,,AccountMode,Changing
   goto, LChange
  }
return
 
Halt:
return
 
Quit:
ControlClick, x422 y626, %AppVer% ;More Button
sleep, 5000
ControlClick, x305 y210, %AppVer% ;Accounts and Devices button
sleep, 5000
ControlClick, x300 y450, %AppVer% ;Log Out button
sleep, 5000
ControlClick, x220 y260, %AppVer% ;Yes Button
sleep, 5000
PixelGetColor, color, 375, 39, %AppVer%  ;Purchase Bar
 If Color = 0x1D78D5
  {
   sleep, 3000
   goto, Quit
   return
  }
return
 
Next:
IfWinExist, %AppVer%
 WinActivate
gosub, RandomWait
gosub, TimersOff
SetTimer, SplashCheck, Off
gosub, RandomWait
goto, LogOff
return
 
Checkbox01:
GuiControlGet, Account1
 If (Account1 = 1)
  return
 If (AccountS = 0)
  {
   AccountMode = ---
   GuiControl,,AccountMode,%AccountMode%
   return
  }
 
LChange:
toggleL = 1
vNext = %Login27%
IfWinExist, %AppVer%
 WinActivate
gosub, SizeCheck
gosub, RandomWait
WinGetPos,X,Y,W,H,A
gosub, RandomWait
If w = 460
 {
  {
   If (AccountS = 1)
    gosub, ModeSingle
   If (AccountS = 0)
    gosub, ModeMiltiple
  }
   goto, LogOff
   return
 }
WinGetPos,X,Y,W,H,A
gosub, RandomWait
 If w = 460
  {
   {
    If (AccountS = 1)
     gosub, ModeSingle
    If (AccountS = 0)
     gosub, ModeMiltiple
   }
   PixelGetColor, color, 150, 550, %AppVer% ;blank field on main droid
    If Color = 0x000000
     {
      varLogin = %vNext%
      goto, CycleAccounts
      return
     }
  }
WinGetPos,X,Y,W,H,A
gosub, RandomWait
 If w != 460
  {
   {
    If (AccountS = 1)
     gosub, ModeSingle
    If (AccountS = 0)
     gosub, ModeMiltiple
   }
   varLogin = %vNext%
   goto, CycleAccounts
   return
  }
return
goto, Quicklog
return
 
InitialStart:
 
IfWinExist, %AppVer%
 WinActivate
Gui 1:Submit, NoHide
varlogin = %LoginSelect%
GuiControl,,Current,%LoginSelect%
PixelSearch, Px, Py, 350, 41, 370, 41, 0x1D78D5, 10, Fast
 If ErrorLevel = 0
  {
   Initial := 0
   goto, Logins2
   return
  }
PixelSearch, Px, Py, 350, 41, 370, 41, 0x1D78D5, 10, Fast
 If ErrorLevel != 0
  {
   goto, CycleAccounts
   return
  }
return
 
QuickLog:
Gui 1:Submit, NoHide
toggleL = 1
vNext = %LoginSelect%
IfWinExist, %AppVer%
 WinActivate
gosub, SizeCheck
gosub, RandomWait
WinGetPos,X,Y,W,H,A
gosub, RandomWait
If w = 460
 {
  {
   If (AccountS = 1)
    gosub, ModeSingle
   If (AccountS = 0)
    gosub, ModeMiltiple
  }
   goto, LogOff
   return
 }
WinGetPos,X,Y,W,H,A
gosub, RandomWait
 If w = 460
  {
   {
    If (AccountS = 1)
     gosub, ModeSingle
    If (AccountS = 0)
     gosub, ModeMiltiple
   }
   PixelGetColor, color, 150, 550, %AppVer% ;blank field on main droid
    If Color = 0x000000
     {
      varLogin = %vNext%
      goto, CycleAccounts
      return
     }
  }
WinGetPos,X,Y,W,H,A
gosub, RandomWait
 If w != 460
  {
   {
    If (AccountS = 1)
     gosub, ModeSingle
    If (AccountS = 0)
     gosub, ModeMiltiple
   }
   varLogin = %vNext%
   goto, CycleAccounts
   return
  }
return
 
ModeSingle:
GuiControl,,AccountS,1
AccountS = 1
AccountMode = Single Account:
GuiControl,,AccountMode,%AccountMode%
return
 
ModeMiltiple:
GuiControl,,AccountS,0
AccountS = 0
AccountMode = Idle
GuiControl,,AccountMode,%AccountMode%
return
 
 
ModeHelps:
GuiControl,,QuickHelps,0
QuickHelps = 0
return
 
DroidHomeCheck:
IfWinExist, %AppVer%
 WinActivate
gosub, SizeCheck
PixelGetColor, color, 80, 80, %AppVer%
 If Color = 0x000000
  {
   PixelGetColor, color, 300, 600, %AppVer%
    If Color = 0x000000
     {
      ControlClick, x90 y333, %AppVer% ;GOW Icon Location
      gosub, RandomWait
      gosub, LoginWait
     }
  }
return
 
 
 
Inactivity1:
gosub, SizeCheck
gosub, RandomWait
PixelGetColor, color, 75, 100, %AppVer%
 If Color = 0x000000
  {
   gosub, RandomWait
   goto, Inactivity2
   return
  }
return
 
Inactivity2:
gosub, RandomWait
PixelGetColor, color, 250, 400, %AppVer%
 If Color = 0x000000
  {
   goto, Inactivity3
   return
  }
return
 
Inactivity3:
gosub, RandomWait
PixelGetColor, color, 400, 600, %AppVer%
 If Color = 0x000000
  {
   gosub, RandomWait
   goto, Droid4X
   return
  }
return
 
 
 
InactivityX1:
IfWinExist, %AppVer%
 WinActivate
PixelGetColor, color, 250, 400, %AppVer%
 ColorI1 = %color%
return
 
InactivityX2:
IfWinExist, %AppVer%
 WinActivate
PixelGetColor, color, 250, 400, %AppVer%
 ColorI2 = %color%
  If ColorI1 = %ColorI2%
   {
    gosub, AllTimersOff
    goto, Droid4X
    return
   }
return
 
 
AllTimersOff:
SetTimer, CityScreen, Off
SetTimer, SplashCheck, off
SetTimer, ContinuousPixelColor, Off
SetTimer, CityScreen, Off
SetTimer, CheckPixelColor, Off
SetTimer, Slot4R3, off
SetTimer, OpenChests1, off
SetTimer, OpenChests2, off
return
 
;------Troubleshooting------
 
^!z::  ; Control+Alt+Z hotkey.
PixelFreeze:
SetTimer, ContinuousPixelColor, Off
Return
 
Pixel:
 If(toggleP)
  {
   toggleP := 0
   SetTimer, ContinuousPixelColor, off
   gosub, RandomWait
   ToolTip,
  }
 Else
  {
   toggleP := 1
   SetTimer, ContinuousPixelColor, 100
  }
return
 
ContinuousPixelColor:
MouseGetPos, MouseX, MouseY, WhichWindow, WhichControl
MouseGetPos, , , , ClassAtPos
PixelGetColor, color, %MouseX%, %MouseY%
PixelGetColor, vthiscolor, %MouseX%, %MouseY%, rgb
 vblue := (vthiscolor & 0xFF)
 vgreen := ((vthiscolor & 0xFF00) >> 8)
 vred := ((vthiscolor & 0xFF0000) >> 16)
ControlGetPos, x, y, w, h, %WhichControl%, ahk_id %WhichWindow%
ControlGetFocus, OutputVar,  Droid4X 0.7.3 Beta 
ToolTip, %WhichWindow%`n%WhichControl%`nX%MouseX%`tY%MouseY%`n%color%`nRed:%vred%`tBlue:%vblue%`tGreen:%vgreen%`n%OutputVar%
return
 
^!x::  ; Control+Alt+X hotkey.
ColorGetNow:
goto, Color
Return
 
Color:
IfWinExist, %AppVer%
 WinActivate
sleep, 2000
GuiControlGet, CXcoord, 3:
GuiControlGet, CYcoord, 3:
PixelGetColor, color, %CXcoord%, %CYcoord%, %AppVer%
sleep, 1000
ColorInfo = %color%
GuiControl,3:,ColorInfo,%ColorInfo%
return
 
Auto:
IfWinExist, %AppVer%
 WinActivate
gosub, SizeCheck
PixelSearch, Px, Py, 345, 37, 357, 57, 0x1D78D5, 20, Fast
 If ErrorLevel = 0
  {
   goto, CycleSubs
   return
  }
gosub, RandomWait
return
 
EditMe:
RunWait,"C:\WINDOWS\system32\notepad.exe" "%A_ScriptFullPath%"
IfWinExist GoWScript.ahk - Notepad
 {
  WinActivate
 }
return
 
;GoW Automation End Part 1 of 3


Ragjr2003
  • Members
  • 9 posts
  • Last active: Oct 25 2015 03:01 PM
  • Joined: 06 Oct 2015
;GoW Automation Part 2 of 3
 
;------Cycle Accounts------------------------------------------------------------
 
CycleAccounts:
;GuiControl,,Current,%Login%
IfWinExist, %AppVer%
 WinActivate
else
{
 Run %Droid4XFileLocation% ;Droid4X 0.8.3
 sleep, 15000
 gosub, DXUpdate
}
gosub, resize
SetTimer, SplashCheck, 60000
SetTimer, Inactivity1, off
gosub, RandomWait
SetTimer, Inactivity1, 240000
gosub, LoggedinCheck
gosub, auto
gosub, LoadWait
;gosub, RandomWait
;gosub, Pinwait
SetTimer, Inactivity1, off
gosub, SizeCheck
goto, Logins
return
 
LoggedinCheck:
PixelSearch, Px, Py, 75, 605, 75, 605, 0x75A322, 50, Fast ;Green Chat Person
 If ErrorLevel = 0
  {
   goto, Logins
  }
return
 
CycleAccountsFix:
GuiControl,,Current,%Login%
GuiControlGet, Login1, 2:
varlogin = %Login%
 
If varlogin := ""
 {
  varlogin = %Login1%
  }
IfWinExist, %AppVer%
 WinActivate
else
{
 Run %Droid4XFileLocation% ;Droid4X 0.8.3
 sleep, 5000
 gosub, DXUpdate
}
 
gosub, resize
SetTimer, SplashCheck, 60000
SetTimer, Inactivity1, off
gosub, RandomWait
SetTimer, Inactivity1, 240000
gosub, auto
gosub, LoadWait
 LoadWaitCounter := 0
SetTimer, Inactivity1, off
gosub, SizeCheck
goto, Logins
return
 
;------LoadWait------
 
LoadWait:
GuiControl,,AccountMode,Loading
GuiControl,,Current,%vNext%
IfWinExist, %AppVer%
 WinActivate
sleep, 200
gosub, sizecheck
sleep, 10000
 
PixelSearch, Px, Py, 130, 600, 385, 600, 0x2F77CA, 3, Fast
 If ErrorLevel = 0
  {
   goto, LoadWait
  }
 
LoadWaitCounter++
If (LoadWaitCounter = 20)
 {
  PixelSearch, Px, Py, 134, 597, 383, 597, 0x2088F4, 5, Fast
   If ErrorLevel != 0
    {
;    MsgBox, 4,, Application may not be responding.`n Would you like to restart Droid4X? (press Yes or No)
;    IfMsgBox Yes
;     {
     gosub, ShutdownDroid4X
SoundBeep
sleep, 2000
SoundBeep
sleep, 2000
SoundBeep
sleep, 2000
SoundBeep
sleep, 2000
SoundBeep
sleep, 2000
SoundBeep
sleep, 2000
     sleep, 5000
     LoadWaitCounter := 0
     goto, CycleAccounts
     return
;     }
;   Else
;    return
   }
 }
 
PixelGetColor, color, 300, 410, %AppVer% ;Gray Login Button (w460)
 If Color = 0x424447
  {
   gosub, RandomWait
   return
  }
 
WinGetPos,X,Y,W,H,A
 If w = 460
 {
  ControlClick, %StartLocation%, %AppVer% ;GOW Icon Location
  gosub, RandomWait
  goto, LoadWait
  return
 }
 
 
PixelGetColor, color, 350, 400, %AppVer% ;Gray Login Button (w1284 h812)
 If Color = 0x424447
  {
   gosub, RandomWait
   return
  }
PixelGetColor, color, 450, 575, %AppVer% ;Gray Login Button (w460 h730)
 If Color != 0x424447
  {
   gosub, RandomWait
   goto, LoadWait
   return
  }
PixelGetColor, color, 450, 575, %AppVer% ;Gray Login Button (w1284 h812)
 If Color = 0x424447
 {
  gosub, resize
  goto, LoadWait
  return
 }
return
 
;------Resize------ w1284, h812 - orig size
 
resize:
gosub, RandomWait
IfWinExist, %AppVer%
 WinActivate
WinGetPos,X,Y,W,H,A
If w != 460
 {
  WinMove,A,,,,460,730
  gosub, RandomWait
  goto, resize
  return
 }
gosub, RandomWait
return
 
 
PinWait:
IfWinExist, %AppVer%
 WinActivate
gosub, RandomWait
WinGetPos,X,Y,W,H,A
gosub, RandomWait
 
PixelGetColor, color, 300, 410, %AppVer% ;Gray Login Button (w460)
 If Color = 0x424447
  {
   gosub, RandomWait
   return
  }
ControlClick, x300 y350, %AppVer% ;Password field
gosub, RandomWait
SendRaw, %pin%
 
return
 
;------LOGINS------
 
Logins:
PixelGetColor, color, 350, 300, %AppVer% ;White Login Field (w460 h730)
 If Color != 0xFFFFFF
  {
   gosub, RandomWait
   goto, Logins
  }
PixelGetColor, color, 350, 300, %AppVer% ;White Login Field (w460 h730)
 If Color = 0xFFFFFF
  {
   gosub, RandomWait
   goto, Logins2
  }
return   
 
Logins2:
GuiControlGet, SkipAccount1, 2:
GuiControlGet, SkipAccount2, 2:
GuiControlGet, SkipAccount3, 2:
GuiControlGet, SkipAccount4, 2:
GuiControlGet, SkipAccount5, 2:
GuiControlGet, SkipAccount6, 2:
GuiControlGet, SkipAccount7, 2:
GuiControlGet, SkipAccount8, 2:
GuiControlGet, SkipAccount9, 2:
GuiControlGet, SkipAccount10, 2:
GuiControlGet, SkipAccount11, 2:
GuiControlGet, SkipAccount12, 2:
GuiControlGet, SkipAccount13, 2:
GuiControlGet, SkipAccount14, 2:
GuiControlGet, SkipAccount15, 2:
GuiControlGet, SkipAccount16, 2:
GuiControlGet, SkipAccount17, 2:
GuiControlGet, SkipAccount18, 2:
GuiControlGet, SkipAccount19, 2:
GuiControlGet, SkipAccount20, 2:
GuiControlGet, SkipAccount21, 2:
GuiControlGet, SkipAccount22, 2:
GuiControlGet, SkipAccount23, 2:
GuiControlGet, SkipAccount24, 2:
GuiControlGet, SkipAccount25, 2:
GuiControlGet, SkipAccount26, 2:
GuiControlGet, Shield1, 2:
GuiControlGet, Shield2, 2:
GuiControlGet, Shield3, 2:
GuiControlGet, Shield4, 2:
GuiControlGet, Shield5, 2:
GuiControlGet, Shield6, 2:
GuiControlGet, Shield7, 2:
GuiControlGet, Shield8, 2:
GuiControlGet, Shield9, 2:
GuiControlGet, Shield10, 2:
GuiControlGet, Shield11, 2:
GuiControlGet, Shield12, 2:
GuiControlGet, Shield13, 2:
GuiControlGet, Shield14, 2:
GuiControlGet, Shield15, 2:
GuiControlGet, Shield16, 2:
GuiControlGet, Shield17, 2:
GuiControlGet, Shield18, 2:
GuiControlGet, Shield19, 2:
GuiControlGet, Shield20, 2:
GuiControlGet, Shield21, 2:
GuiControlGet, Shield22, 2:
GuiControlGet, Shield23, 2:
GuiControlGet, Shield24, 2:
GuiControlGet, Shield25, 2:
GuiControlGet, Shield26, 2:
GuiControlGet, Train1, 2:
GuiControlGet, Train2, 2:
GuiControlGet, Train3, 2:
GuiControlGet, Train4, 2:
GuiControlGet, Train5, 2:
GuiControlGet, Train6, 2:
GuiControlGet, Train7, 2:
GuiControlGet, Train8, 2:
GuiControlGet, Train9, 2:
GuiControlGet, Train10, 2:
GuiControlGet, Train11, 2:
GuiControlGet, Train12, 2:
GuiControlGet, Train13, 2:
GuiControlGet, Train14, 2:
GuiControlGet, Train15, 2:
GuiControlGet, Train16, 2:
GuiControlGet, Train17, 2:
GuiControlGet, Train18, 2:
GuiControlGet, Train19, 2:
GuiControlGet, Train20, 2:
GuiControlGet, Train21, 2:
GuiControlGet, Train22, 2:
GuiControlGet, Train23, 2:
GuiControlGet, Train24, 2:
GuiControlGet, Train25, 2:
GuiControlGet, Train26, 2:
GuiControlGet, Donate1, 2:
GuiControlGet, Donate2, 2:
GuiControlGet, Donate3, 2:
GuiControlGet, Donate4, 2:
GuiControlGet, Donate5, 2:
GuiControlGet, Donate6, 2:
GuiControlGet, Donate7, 2:
GuiControlGet, Donate8, 2:
GuiControlGet, Donate9, 2:
GuiControlGet, Donate10, 2:
GuiControlGet, Donate11, 2:
GuiControlGet, Donate12, 2:
GuiControlGet, Donate13, 2:
GuiControlGet, Donate14, 2:
GuiControlGet, Donate15, 2:
GuiControlGet, Donate16, 2:
GuiControlGet, Donate17, 2:
GuiControlGet, Donate18, 2:
GuiControlGet, Donate19, 2:
GuiControlGet, Donate20, 2:
GuiControlGet, Donate21, 2:
GuiControlGet, Donate22, 2:
GuiControlGet, Donate23, 2:
GuiControlGet, Donate24, 2:
GuiControlGet, Donate25, 2:
GuiControlGet, Donate26, 2:
GuiControlGet, Heal1, 2:
GuiControlGet, Heal2, 2:
GuiControlGet, Heal3, 2:
GuiControlGet, Heal4, 2:
GuiControlGet, Heal5, 2:
GuiControlGet, Heal6, 2:
GuiControlGet, Heal7, 2:
GuiControlGet, Heal8, 2:
GuiControlGet, Heal9, 2:
GuiControlGet, Heal10, 2:
GuiControlGet, Heal11, 2:
GuiControlGet, Heal12, 2:
GuiControlGet, Heal13, 2:
GuiControlGet, Heal14, 2:
GuiControlGet, Heal15, 2:
GuiControlGet, Heal16, 2:
GuiControlGet, Heal17, 2:
GuiControlGet, Heal18, 2:
GuiControlGet, Heal19, 2:
GuiControlGet, Heal20, 2:
GuiControlGet, Heal21, 2:
GuiControlGet, Heal22, 2:
GuiControlGet, Heal23, 2:
GuiControlGet, Heal24, 2:
GuiControlGet, Heal25, 2:
GuiControlGet, Heal26, 2:
GuiControlGet, Move1, 2:
GuiControlGet, Move2, 2:
GuiControlGet, Move3, 2:
GuiControlGet, Move4, 2:
GuiControlGet, Move5, 2:
GuiControlGet, Move6, 2:
GuiControlGet, Move7, 2:
GuiControlGet, Move8, 2:
GuiControlGet, Move9, 2:
GuiControlGet, Move10, 2:
GuiControlGet, Move11, 2:
GuiControlGet, Move12, 2:
GuiControlGet, Move13, 2:
GuiControlGet, Move14, 2:
GuiControlGet, Move15, 2:
GuiControlGet, Move16, 2:
GuiControlGet, Move17, 2:
GuiControlGet, Move18, 2:
GuiControlGet, Move19, 2:
GuiControlGet, Move20, 2:
GuiControlGet, Move21, 2:
GuiControlGet, Move22, 2:
GuiControlGet, Move23, 2:
GuiControlGet, Move24, 2:
GuiControlGet, Move25, 2:
GuiControlGet, Move26, 2:
GuiControlGet, NoAutoRestart, 2:
GuiControlGet, ShieldNow, 1:
GuiControlGet, BuildNow, 1:
GuiControlGet, DonatedNow, 1:
GuiControlGet, HealNow, 1:
GuiControlGet, TrainNow, 1:
 
If varLogin = %Login1%
 {
  toggleCh := false
  If (SkipAccount1 = 1)
   varLogin = %Login2%
  If (SkipAccount1 = 0)
  {
   Login = %Login1%
   pwd = %pwd1%
   vNext = %Login2%
   vID = 1
  }
  If login = [email protected]
   {
    MsgBox, You must add at least one account.
    goto, EditHelp
    return
   }
  If login = unused
   varLogin = %Login2%
 }
If varLogin = %Login2%
 {
 
  If (SkipAccount2 = 1)
   varLogin = %Login3%
  If (SkipAccount2 = 0)
  {
   login = %Login2%
   pwd = %pwd2%
   vNext = %Login3%
   vID = 2
  }
  If login = unused
   varLogin = %Login3%
 }
If varLogin = %Login3%
 {
  If (SkipAccount3 = 1)
   varLogin = %Login4%
  If (SkipAccount3 = 0)
  {
   login = %Login3%
   pwd = %pwd3%
   vNext = %Login4%
   vID = 3
  }
  If login = unused
   varLogin = %Login4%
 }
If varLogin = %Login4%
 {
  If (SkipAccount4 = 1)
   varLogin = %Login5%
  If (SkipAccount4 = 0)
  {
   login = %Login4%
   pwd = %pwd4%
   vNext = %Login5%
   vID = 4
  }
  If login = unused
   varLogin = %Login5%
 }
If varLogin = %Login5%
 {
  If (SkipAccount5 = 1)
   varLogin = %Login6%
  If (SkipAccount5 = 0)
  {
   login = %Login5%
   pwd = %pwd5%
   vNext = %Login6%
   vID = 5
  }
  If login = unused
   varLogin = %Login6%
 }
If varLogin = %Login6%
 {
  If (SkipAccount6 = 1)
   varLogin = %Login7%
  If (SkipAccount6 = 0)
  {
   login = %Login6%
   pwd = %pwd6%
   vNext = %Login7%
   vID = 6
  }
  If login = unused
   varLogin = %Login7%
 }
If varLogin = %Login7%
 {
  If (SkipAccount7 = 1)
   varLogin = %Login8%
  If (SkipAccount7 = 0)
  {
   login = %Login7%
   pwd = %pwd7%
   vNext = %Login8%
   vID = 7
  }
  If login = unused
   varLogin = %Login8%
 }
If varLogin = %Login8%
 {
  If (SkipAccount8 = 1)
   varLogin = %Login9%
  If (SkipAccount8 = 0)
  {
   login = %Login8%
   pwd = %pwd8%
   vNext = %Login9%
   vID = 8
  }
  If login = unused
   varLogin = %Login9%
 }
If varLogin = %Login9%
 {
  If (SkipAccount9 = 1)
   varLogin = %Login10%
  If (SkipAccount9 = 0)
  {
   login = %Login9%
   pwd = %pwd9%
   vNext = %Login10%
   vID = 9
  }
  If login = unused
   varLogin = %Login10%
 }
If varLogin = %Login10%
 {
  If (SkipAccount10 = 1)
   varLogin = %Login11%
  If (SkipAccount10 = 0)
  {
   login = %Login10%
   pwd = %pwd10%
   vNext = %Login11%
   vID = 10
  }
  If login = unused
   varLogin = %Login11%
 }
If varLogin = %Login11%
 {
  If (SkipAccount11 = 1)
   varLogin = %Login12%
  If (SkipAccount11 = 0)
  {
   login = %Login11%
   pwd = %pwd11%
   vNext = %Login12%
   vID = 11
  }
  If login = unused
   varLogin = %Login12%
 }
If varLogin = %Login12%
 {
  If (SkipAccount12 = 1)
   varLogin = %Login13%
  If (SkipAccount12 = 0)
  {
   login = %Login12%
   pwd = %pwd12%
   vNext = %Login13%
   vID = 12
  }
  If login = unused
   varLogin = %Login13%
 }
If varLogin = %Login13%
 {
  If (SkipAccount13 = 1)
   varLogin = %Login14%
  If (SkipAccount13 = 0)
  {
   login = %Login13%
   pwd = %pwd13%
   vNext = %Login14%
   vID = 13
  }
  If login = unused
   varLogin = %Login14%
 }
If varLogin = %Login14%
 {
  If (SkipAccount14 = 1)
   varLogin = %Login15%
  If (SkipAccount14 = 0)
  {
   login = %Login14%
   pwd = %pwd14%
   vNext = %Login15%
   vID = 14
  }
  If login = unused
   varLogin = %Login15%
 }
If varLogin = %Login15%
 {
  If (SkipAccount15 = 1)
   varLogin = %Login16%
  If (SkipAccount15 = 0)
  {
   login = %Login15%
   pwd = %pwd15%
   vNext = %Login16%
   vID = 15
  }
  If login = unused
   varLogin = %Login16%
 }
If varLogin = %Login16%
 {
  If (SkipAccount16 = 1)
   varLogin = %Login17%
  If (SkipAccount16 = 0)
  {
   login = %Login16%
   pwd = %pwd16%
   vNext = %Login17%
   vID = 16
  }
  If login = unused
   varLogin = %Login17%
 }
If varLogin = %Login17%
 {
  If (SkipAccount17 = 1)
   varLogin = %Login18%
  If (SkipAccount17 = 0)
  {
   login = %Login17%
   pwd = %pwd17%
   vNext = %Login18%
   vID = 17
  }
  If login = unused
   varLogin = %Login18%
 }
If varLogin = %Login18%
 {
  If (SkipAccount18 = 1)
   varLogin = %Login19%
  If (SkipAccount18 = 0)
  {
   login = %Login18%
   pwd = %pwd18%
   vNext = %Login19%
   vID = 18
  }
  If login = unused
   varLogin = %Login19%
 }
If varLogin = %Login19%
 {
  If (SkipAccount19 = 1)
   varLogin = %Login20%
  If (SkipAccount19 = 0)
  {
   login = %Login19%
   pwd = %pwd19%
   vNext = %Login20%
   vID = 19
  }
  If login = unused
   varLogin = %Login20%
 }
If varLogin = %Login20%
 {
  If (SkipAccount20 = 1)
   varLogin = %Login21%
  If (SkipAccount20 = 0)
  {
   login = %Login20%
   pwd = %pwd20%
   vNext = %Login21%
   vID = 20
  }
  If login = unused
   varLogin = %Login21%
 }
If varLogin = %Login21%
 {
  If (SkipAccount21 = 1)
   varLogin = %Login22%
  If (SkipAccount21 = 0)
  {
   login = %Login21%
   pwd = %pwd21%
   vNext = %Login22%
   vID = 21
  }
  If login = [email protected]
   varLogin = %Login22%
 }
If varLogin = %Login22%
 {
  If (SkipAccount22 = 1)
   varLogin = %Login23%
  If (SkipAccount22 = 0)
  {
   login = %Login22%
   pwd = %pwd22%
   vNext = %Login23%
   vID = 22
  }
  If login = unused
   varLogin = %Login23%
 }
If varLogin = %Login23%
 {
  If (SkipAccount23 = 1)
   varLogin = %Login24%
  If (SkipAccount23 = 0)
  {
   login = %Login23%
   pwd = %pwd23%
   vNext = %Login24%
   vID = 23
  }
  If login = unused
   varLogin = %Login24%
 }
If varLogin = %Login24%
 {
  If (SkipAccount24 = 1)
   varLogin = %Login25%
  If (SkipAccount24 = 0)
  {
   login = %Login24%
   pwd = %pwd24%
   vNext = %Login25%
   vID = 24
  }
   If login = unused 
   varLogin = %Login25%
 }
If varLogin = %Login25%
 {
  If (SkipAccount25 = 1)
   varLogin = %Login26%
  If (SkipAccount25 = 0)
  {
   login = %Login25%
   pwd = %pwd25%
   vNext = %Login26%
   vID = 25
   }
   If login = 
   varLogin = %vNext%
 }
If varLogin = %Login26%
 {
  If (SkipAccount26 = 1)
   varLogin = 61
  If (SkipAccount26 = 0)
  {
   login = %Login26%
   pwd = %pwd26%
   vNext = %Login27%
   vID = 26
   }
   If login = [email protected]
   varLogin = %vNext%
 }
If varLogin = %Login27%
 {
  login = %Login27%
  vNext = %Login28%
  pwd = %pwd27%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login28%
 {
  login = %Login28%
  vNext = %Login29%
  pwd = %pwd28%
  vID = 26
   If login = unused 
   varLogin = %vNext%
}
If varLogin = %Login29%
 {
  login = %Login29%
  vNext = %Login30%
  pwd = %pwd29%
  vID = 26
   If login = unused 
   varLogin = %vNext%
}
If varLogin = %Login30%
 {
  login = %Login30%
  vNext = %Login31%
  pwd = %pwd30%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login31%
 {
  login = %Login31%
  vNext = %Login32%
  pwd = %pwd31%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login32%
 {
  login = %Login32%
  vNext = %Login33%
  pwd = %pwd32%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login33%
 {
  login = %Login33%
  vNext = %Login34%
  pwd = %pwd33%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login34%
 {
  login = %Login34%
  vNext = %Login35%
  pwd = %pwd34%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login35%
 {
  login = %Login35%
  vNext = %Login36%
  pwd = %pwd35%
  vID = 26
  If login = unused
   varLogin = %Login36%
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login36%
 {
  login = %Login36%
  vNext = %Login37%
  pwd = %pwd36%
  vID = 26
    If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login37%
 {
  login = %Login37%
  vNext = %Login38%
  pwd = %pwd37%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login38%
 {
  login = %Login38%
  vNext = %Login39%
  pwd = %pwd38%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login39%
 {
  login = %Login39%
  vNext = %Login40%
  pwd = %pwd39%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login40%
 {
  login = %Login40%
  vNext = %Login41%
  pwd = %pwd40%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login41%
 {
  login = %Login41%
  vNext = %Login42%
  pwd = %pwd41%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login42%
 {
  login = %Login42%
  vNext = %Login43%
  pwd = %pwd42%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login43%
 {
  login = %Login43%
  vNext = %Login44%
  pwd = %pwd43%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login44%
 {
  login = %Login44%
  vNext = %Login45%
  pwd = %pwd44%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login45%
 {
  login = %Login45%
  vNext = %Login46%
  pwd = %pwd45%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login46%
 {
  login = %Login46%
  vNext = %Login47%
  pwd = %pwd46%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login47%
 {
  login = %Login47%
  vNext = %Login48%
  pwd = %pwd47%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login48%
 {
  login = %Login48%
  vNext = %Login49%
  pwd = %pwd48%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login49%
 {
  login = %Login49%
  vNext = %Login50%
  pwd = %pwd49%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login50%
 {
  login = %Login50%
  vNext = %Login51%
  pwd = %pwd50%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login51%
 {
  login = %Login51%
  vNext = %Login52%
  pwd = %pwd51%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login52%
 {
  login = %Login52%
  vNext = %Login53%
  pwd = %pwd52%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login53%
 {
  login = %Login53%
  vNext = %Login54%
  pwd = %pwd53%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login54%
 {
  login = %Login54%
  vNext = %Login55%
  pwd = %pwd54%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login55%
 {
  login = %Login55%
  vNext = %Login56%
  pwd = %pwd55%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login56%
 {
  login = %Login56%
  vNext = %Login57%
  pwd = %pwd56%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login57%
 {
  login = %Login57%
  vNext = %Login58%
  pwd = %pwd57%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login58%
 {
  login = %Login58%
  vNext = %Login59%
  pwd = %pwd58%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login59%
 {
  login = %Login59%
  vNext = %Login60%
  pwd = %pwd59%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = %Login60%
 {
  login = %Login60%
  vNext = 61
  pwd = %pwd60%
  vID = 26
   If login = unused 
   varLogin = %vNext%
 }
If varLogin = 61
 {
  If (NoAutoRestart = 0)
   {
    BuildMe := 0
    ShieldMe := 0
    HealMe := 0
    MoveMe := 0
    Full++
    varLogin = %Login1%
    gosub, Droid4X
    goto, CycleAccounts
    return
   }
  If (NoAutoRestart = 1)
   {
    varLogin = %Login1%
    goto, Logins
    return
   }
 }
If (ShieldNow = 1)
 {
  ShieldMe = 1
 }
If (ShieldNow = 0)
 {
  If (Shield%vID% = 1)
   {
    ShieldMe = 1
   }
 }
If (BuildNow = 1)
 {
  BuildMe = 1
 }
If (BuildNow = 0)
 {
  If (Build%vID% = 1)
   {
    BuildMe = 1
   }
 }
 
If (DonateNow = 1)
 {
  DonateMe = 1
 }
If (DonateNow = 0)
 {
  If (Donate%vID% = 1)
   {
    DonateMe = 1
   }
 }
If (HealNow = 1)
 {
  HealMe = 1
 }
If (HealNow = 0)
 {
  If (Heal%vID% = 1)
   {
    HealMe = 1
   }
 }
If (TrainNow = 1)
 {
  TrainMe = 1
 }
If (TrainNow = 0)
 {
  If (Train%vID% = 1)
   {
    TrainMe = 1
   }
 }
If (Move%vID% = 1)
 {
MoveMe = 1
 }
gosub, SizeCheck
gosub, RandomWait
 
If (Initial = 1)
 {
  BuildReturn = CheckPixelColor
  goto, Send
 }
If (Initial = 0)
 {
  Initial := 1
  BuildReturn = cyclesubs
  goto, cyclesubs
 }
return
 
;------Send------
 
 
 
Send:
gosub, InactivityX1
SetTimer, InactivityX2, 120000
gosub, sizecheck
gosub, SendLogin
gosub, SendPassword
 
PixelGetColor, color, 300, 400, %AppVer% ;Log Out Yes Button
 If Color != 0x474100
  {
   sleep, 1000
   goto, Send
   return
  }
ControlClick, x300 y400, %AppVer% ;Login Button
   sleep, 1000
PixelGetColor, color, 300, 325, %AppVer% ;Forgot Password error
 If Color = 0x474100
  {
   ControlClick, x410 y150, %AppVer% ;Close
   sleep, 3000
   goto, Send
   return
  }
PixelGetColor, color, 300, 225, %AppVer% ;Login Failed Error
 If Color = 0x474100
  {
   ControlClick, x300 y225, %AppVer% ;Close
   sleep, 1000
   goto, Send
   return
  }
else
 {
  GuiControl,,AccountMode,Logging In
  Count++
  GuiControl,,Count,( %Count% / %Full% )
  SetTimer, InactivityX2, Off
  toggleL = 0
  toggleB := 1
  goto, LoginWait
 }
return
 
SendLogin:
gosub, RandomWait
PixelSearch, Px, Py, 160, 300, 355, 305, 0x696969, 30, Fast
 If ErrorLevel != 0
  {
   ControlClick, x300 y300, %AppVer% ;MZ Account Email field
   sleep, 1000
   SendRaw, %Login%
   sleep, 1000
   ControlClick, x80 y80, %AppVer% ;Upper Right Corner of Login Page
   goto, SendLogin
  }
GuiControl,,Current,%Login%
   sleep, 1000
return
 
SendPassword:
gosub, RandomWait
PixelSearch, Px, Py, 160, 345, 200, 350, 0x696969, 20, Fast
 If ErrorLevel != 0
  {
   ControlClick, x300 y350, %AppVer% ;Password field
   sleep, 1000
   SendRaw, %pwd%
   sleep, 1000
   ControlClick, x80 y80, %AppVer% ;Upper Right Corner of Login Page
   goto, SendPassword
  }
   sleep, 1000
return
 
 
LoginCheck:
PixelGetColor, color, 300, 400, %AppVer% ;Log Out Yes Button
 If Color != 0x474100
  {
   ControlClick, x30 y620, %AppVer% ;Droid Back Button
   sleep, 3000
   goto, CycleAccounts
  }
return
 
;------LoginWait------
 
LoginWait:
gosub, InactivityX1
SetTimer, InactivityX2, 240000
sleep, 200
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   SetTimer, InactivityX2, Off
   goto, LoginWait2
   return
  }
else
 {
  gosub, RandomWait
  goto, LoginWait
  return
 }
return
 
LoginWait2:
gosub, InactivityX1
SetTimer, InactivityX2, 120000
sleep, 1000
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x420 y120, %AppVer% ;Close Summer Sale Pack
   sleep, 1000
  }
 
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y55, %AppVer% ;Close Legendary Hero Gear Pack
   sleep, 1000
  }
 
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y160, %AppVer% ;Close Legendary Hero Gear Pack
   sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y160, %AppVer% ;Close Legendary Hero Gear Pack
   sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x410 y130, %AppVer% ;Close Button Research Pack
   sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y50, %AppVer% ;Close Monster Sale Pack
   sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y53, %AppVer% ;Close Button Minotaur Pack
   sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   goto, LoginWait2
   return
  }
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, resize
   goto, LoginWait2
   return
  }
SetTimer, InactivityX2, Off
GuiControl,,AccountMode,Searching
goto, CheckPixelColor
return
 
;------Logoff------
 
Logoff:
IfWinExist, %AppVer%
WinActivate
  BuildMe := 0
  ShieldMe := 0
  HealMe := 0
  MoveMe := 0
  TrainMe := 0
  toggleL := 0
  toggleA := 1
  toggleB := 1
  BeepCounter := 0
  LoadWaitCounter := 0
 
     If varlogin = 
      {
       varlogin = %Login1%
      }
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, resize
  }
sleep, 3000
PixelSearch, Px, Py, 70, 685, 430, 700, 0xAA8C00, 5, Fast
 If ErrorLevel = 0
 {
  varLogin = %vNext%
  sleep, 3000
  goto, CycleAccounts
  return
 }
 
PixelGetColor, color, 150, 200, %AppVer%  ;Accounts and Devices button
 If Color = 0x000000
 {
  PixelGetColor, color, 300, 500, %AppVer%  ;Accounts and Devices button
   If Color = 0x000000
    {
     varLogin = %vNext%
     GuiControl,,AccountMode,Starting
     goto, CycleAccounts
     return
    }
 }
PixelSearch, Px, Py, 320, 220, 320, 220, 0x4AA723, 10, Fast
 If ErrorLevel != 0
  {
  gosub, RandomWait
  gosub, CityScreen
  ControlClick, x422 y694, %AppVer% ;More Button
  gosub, RandomWait
  GuiControl,,AccountMode,Logging Off
  goto, Logoff
  return
 }
PixelSearch, Px, Py, 320, 220, 320, 220, 0x4AA723, 10, Fast
 If ErrorLevel = 0
  {
  SetTimer, CityScreen, Off
  SetTimer, SplashCheck, Off
  SetTimer, CheckPixelColor, Off  
  goto, Logoff1
  return
 }
return
 
Logoff1:
   sleep, 1000
PixelGetColor, color, 300, 490, %AppVer% ;Log Out Button
 If Color != 0x030839
  {
   ControlClick, x305 y226, %AppVer% ;Accounts and Devices button
   goto, Logoff1
   return
  }
PixelGetColor, color, 300, 490, %AppVer% ;Log Out Button
 If Color = 0x030839
  {
   ControlClick, x300 y490, %AppVer% ;Log Out button
   goto, Logoff2
   return
  }
return
 
Logoff2:
   sleep, 1000
PixelGetColor, color, 300, 490, %AppVer% ;Log Out Button
 If Color = 0x030839
  {
   ControlClick, x300 y490, %AppVer% ;Log Out button
   goto, Logoff2
   return
  }
PixelGetColor, color, 220, 300, %AppVer% ;Log Out Yes Button
 If Color = 0x474100
  {
   ControlClick, x220 y300, %AppVer% ;Log Out Yes Button
   goto, Logoff2
   return
  }
PixelGetColor, color, 220, 300, %AppVer% ;Log Out Yes Button
 If Color != 0x474100
  {
  goto, Logoff3
  return
 }
return
 
Logoff3:
GuiControlGet, AccountQ, 2:
toggleB := 1
ControlClick, x220 y300, %AppVer% ;Yes Button
   sleep, 1000
If varLogin = 
 {
    varLogin = %Login1%
 }
PixelGetColor, color, 220, 300, %AppVer% ;Log Out Yes Button
 If Color = 0x474100
  {
   ControlClick, x220 y300, %AppVer% ;Log Out button
   goto, Logoff3
   return
  }
else
 {
  varLogin = %vNext%
sleep, 10000
  goto, CycleAccounts
  return
 }
return
 
;------Maintenance--------------------------------------------------------
 
GoHomeStart:
        SetTimer, CityScreen, 100000
return
 
Begin:
If(toggle)
 {
  toggle := 0
  gosub, TimersOff
  return
 }
else
 {
  toggle := 1
  gosub, TimersOn
  return
 }
 
Start:
 toggle := 1
IfWinExist, %AppVer%
 WinActivate
   sleep, 1000
return
 
TimersOn:
toggle := 1
IfWinExist, %AppVer%
 WinActivate
   sleep, 1000
return
 
TimersOff:
SetTimer, CityScreen, Off
SetTimer, LogOff, Off
return
 
SplashCheck:
   sleep, 1000
PixelGetColor, color, 120, 550, %AppVer% ;Hero Level Up
 If Color = 0X474100
  {
   ControlClick, x120 y550, %AppVer% ;Close Button
   gosub, RandomWait
   goto, SplashCheck
  }
PixelGetColor, color, 225, 375, %AppVer% ;Hero Level Up
 If Color = 0X0F5CAB
  {
   ControlClick, x225 y375, %AppVer% ;Close Button
   gosub, RandomWait
   goto, SplashCheck
 }
PixelGetColor, color, 200, 500, %AppVer% ;Hero Level Up
 If Color = 0X474100
  {
   ControlClick, x200 y500, %AppVer% ;Close Button
   gosub, RandomWait
   goto, SplashCheck
  }
PixelGetColor, color, 290, 375, %AppVer%  ;Secret GIft Collect
 If Color = 0x05fCAB
  {
   ControlClick, x290 y375, %AppVer%
   gosub, RandomWait
   goto, SplashCheck
   gosub, RandomWait
  }
return
 
AllianceCityTopMenu:
   sleep, 1000
PixelSearch, Px, Py, 325, 50, 320, 50, 0x101427, 50, Fast
 If ErrorLevel != 0
  {
   ControlClick, x325 y50, %AppVer% ;Alliance City Top Icon
   goto, AllianceCityTopMenu
   return
   }
return
 
AllianceCityScreen:
gosub, RandomWait
PixelSearch, Px, Py, 400, 400, 400, 400, 0x474100, 0, Fast
 If ErrorLevel != 0
  {
   ControlClick, x240 y400, %AppVer% ;Alliance City
   goto, AllianceCityScreen
   return
  }
goto, AllianceCityEnter
return
 
AllianceCityEnter:
PixelSearch, Px, Py, 350, 45, 350, 45, 0x1D78D5, 50, Fast
 If ErrorLevel != 0
  {
   ControlClick, x400 y400, %AppVer% ;Alliance City
   goto, AllianceCityEnter
   return
  }
gosub, AllianceCityQuest
return
 
;------Check-subs------------Check-subs------------Check-subs------
 
CheckPixelColor:
SetTimer, SplashCheck, 250000
gosub, TimersOn
GuiControlGet, QuickHelps
If (QuickHelps = 1)
    {
     toggleB := 0
     ;Alliance Helps
     PixelSearch, Px, Py, 422, 544, 422, 544, 0X011CDD, 100, Fast, %AppVer% ;Alliance Help
   If ErrorLevel = 0
       {
  GuiControl,,AccountMode,Helping
        gosub, HelpIcon
        gosub, RandomWait
       }
     ;Athena Chest
     PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
     AC1 = %color%
     sleep, 1000
     PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
     AC2 = %color%
 If AC1 != %AC2%
     {
      gosub, AthenaChest
     }
 If (MoveMe = 1)
       {
        gosub, ChangeAllianceTag
        gosub, RandomWait
       }
 If (MoveMe = 0)
       {
        gosub, RandomWait
       }
    SetTimer, SplashCheck, off
    goto, LogOff
    return
   }
If (QuickHelps = 0)
    {
  If (MoveMe = 1)
      {
       gosub, ChangeAllianceTag
       gosub, RandomWait
      }
  If (MoveMe = 0)
      {
       If (toggleB = 1)
        {
         GuiControl,,AccountMode,Building
         BuildReturn = CheckPixelColor
         goto, Build
        }
       GuiControl,,AccountMode,Questing
       gosub, Quests
      }
     gosub, RandomWait
     goto, cyclesubs
    }
return
 
CycleSubs:
IfWinExist, %AppVer%
 WinActivate
GuiControlGet, AccountS, 1:
If (AccountS = 1)
 {
  AccountMode = Single Account:
 }
If (AccountS = 0)
 { 
  AccountMode = Starting
  GuiControl,,AccountMode,%AccountMode%
 }
SetTimer, SplashCheck, off
gosub, RandomWait
SetTimer, SplashCheck, 250000
gosub, DroidHomeCheck
gosub, CityScreen
 
If (ShieldMe = 1)
 {
  If (toggleA = 1)
   {
  GuiControl,,AccountMode,Shielding
     goto, Shield
   }
 }
 
If (TrainMe = 1)
 {
  If (toggleTrain = 0)
   {
    gosub, Train
    }
 }
 
 
If (DonateMe = 1)
 {
  If (toggleDn = 0)
   {
    gosub, DonateRSS
    }
 }
 
  If (toggleB = 1)
   {
    GuiControl,,AccountMode,Building
    BuildReturn = cyclesubs
    goto, Build
   }
 
If (BeepCounter != 0)
{
MsgBox, Error
goto, Pause
}
If (BeepCounter = 0)
{
SoundBeep
BeepCounter++
}
gosub, RandomWait
;Alliance Gift
SetTimer, InactivityX2, off
PixelSearch, Px, Py, 277, 675, 284, 678, 0X175F1F, 25, Fast, %AppVer% ;Alliance Gift
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 360000
   GuiControl,,AccountMode,Alliance Gifts
   gosub, GiftAlliance
   SetTimer, CityScreen, Off
   sleep, 3000
  }
 
gosub, DroidHomeCheck
gosub, CityScreen
 
;Alliance Helps
PixelSearch, Px, Py, 445, 550, 445, 550, 0X282EA0, 10, Fast, %AppVer% ;Alliance Help
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 120000
   GuiControl,,AccountMode,Helping
   gosub, HelpIcon
   SetTimer, CityScreen, Off
   sleep, 3000
  }
     ;Alliance Helps
PixelSearch, Px, Py, 422, 544, 422, 548, 0X011CDD, 10, Fast, %AppVer% ;Alliance Help
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 120000
   GuiControl,,AccountMode,Helping
   gosub, HelpIcon
   SetTimer, CityScreen, Off
   sleep, 3000
  }
     ;Alliance Helps
PixelSearch, Px, Py, 442, 545, 422, 548, 0X2C32A2, 10, Fast, %AppVer% ;Alliance Help
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 120000
   GuiControl,,AccountMode,Helping
   gosub, HelpIcon
   SetTimer, CityScreen, Off
   sleep, 3000
  }
 
 
If (HealMe = 1)
 {
    gosub, DroidHomeCheck
    gosub, CityScreen
 
    ;HealCheck
    PixelSearch, Px, Py, 85, 130, 360, 610, 0xE8F8FF, 3, Fast
     If ErrorLevel = 0
      {
       Py += 50
       ControlClick, x%Px% y%Py%, %AppVer% ;Upgrade Arrow
       sleep, 3000
       GuiControl,,AccountMode,Healing
       gosub, QueAllTroops
      }
    }
 
gosub, DroidHomeCheck
gosub, CityScreen
 
;Dungeon
PointsEmpty = 1
SetTimer, InactivityX2, off
PixelGetColor, color, 345, 510, %AppVer% ;Dungeon
DP1 = %color%
     sleep, 1000
PixelGetColor, color, 345, 510, %AppVer% ;Dungeon
DP2 = %color%
 If DP1 != %DP2%
  {
   SetTimer, CityScreen, 120000
   GuiControl,,AccountMode,Dungon
   gosub, Dungeon1
   SetTimer, CityScreen, Off
   sleep, 3000
  }
 
;gosub, DroidHomeCheck
gosub, CityScreen
 
;Secret Chest
SetTimer, InactivityX2, off
PixelGetColor, color, 110, 511, %AppVer% ;Secret GIft
 SC1 = %color%
     sleep, 1000
PixelGetColor, color, 110, 511, %AppVer% ;Secret GIft
 SC2 = %color%
 If SC1 != %SC2%
  {
   SetTimer, CityScreen, 120000
   GuiControl,,AccountMode,Secret Chest
   gosub, SecretChest
   SetTimer, CityScreen, Off
   sleep, 3000
  }
 
gosub, DroidHomeCheck
gosub, CityScreen
 
;Athena Chest
SetTimer, InactivityX2, off
PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
 AC1 = %color%
     sleep, 1000
PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
 AC2 = %color%
 If AC1 != %AC2%
 {
  SetTimer, CityScreen, 120000
  gosub, AthenaChest
  SetTimer, CityScreen, Off
  sleep, 3000
 }
 
gosub, DroidHomeCheck
gosub, CityScreen
 
;AllianceCityQuest
;   gosub, MapScreen
;   gosub, RandomWait
;   gosub, AllianceCityTopMenu
;   gosub, AllianceCityScreen
;   gosub, RandomWait
;   gosub, CityScreen
 
;QuestsCyle
        SetTimer, InactivityX2, off
PixelSearch, Px, Py, 143, 680, 150, 686, 0x0C9401, 100, Fast, %AppVer% ;Green Checkmark
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 300000
   GuiControl,,AccountMode,Questing
   gosub, QuestCheck
   SetTimer, CityScreen, Off
   sleep, 3000
   }
 
gosub, SizeCheck
gosub, CityScreen
 
If (AccountS = 1)
 {
  GuiControl,,AccountMode,Starting over
  goto, CycleSubs
 }
If (AccountS = 0)
 {
  SetTimer, SplashCheck, off
  goto, LogOff
 }
return
 
;------Cycle Subs------------Cycle Subs------------Cycle Subs------
 
;------Alliance Help------
 
HelpIcon:
toggle := 0
gosub, TimersOff
ControlClick, x422 y544, %AppVer% ;select Help Icon
sleep, 2000
PixelGetColor, color, 400, 580, %AppVer%  
 If Color = 0x0F5CAB
  goto HelpIcon2
 Else
  {
   sleep, 1000
   goto, HelpIcon
  }
return
 
HelpIcon2:
ControlClick, x400 y580, %AppVer%  ;select Help All
   sleep, 1000
PixelGetColor, color, 400, 580, %AppVer%  
 If Color = 0x0F5CAB
  goto, HelpIcon2
 else
  gosub, CityScreen
return
 
;------Alliance GIft------
 
GiftAlliance:
toggle := 0
gosub, TimersOff
sleep, 3000
PixelGetColor, color, 435, 235, %AppVer%  ;Alliance Gift
 If Color = 0x474100
  {
   goto, AGiftWait
  }
PixelGetColor, color, 435, 235, %AppVer%  ;Alliance Gift
 If Color != 0x474100
  {
   ControlClick, x300 y700, %AppVer% ;select Alliance Icon with Gift
   gosub, GiftAlliance
  }
return
 
AGiftWait:
sleep, 3000
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, RestartDroidFail
  }
PixelGetColor, color, 435, 235, %AppVer%
 If (Color = 0x474100 or Color = 0x030839) ;Green or Red Icon
  {
   goto, Click
   return
  }
PixelGetColor, color, 435, 235, %AppVer%
 If (Color != 0x474100 or Color != 0x030839) ;Green or Red Icon
  {
   ControlClick, x435 y235, %AppVer% ;select Open Alliance GIft Icon
   goto, AGiftWait
  }
return
 
Click:
IfWinExist, %AppVer%
 WinActivate
gosub, RandomWait1
PixelGetColor, color, 435, 235, %AppVer%  
 If Color = 0x424447 ;Grey Icon
  {
   goto, Click
  }
PixelGetColor, color, 435, 235, %AppVer%
 If (Color = 0x474100 or Color = 0x030839) ;Green or Red Icon
  {
   ControlClick, x435 y235, %AppVer% ;select Open gIft
   goto, Click
  }
PixelSearch, Px, Py, 411, 189, 411, 189, 0x758DA0, 25, Fast
 If ErrorLevel = 0
  {
   gosub, CityScreen
   return
  }
PixelSearch, Px, Py, 411, 189, 411, 189, 0x758DA0, 25, Fast
 If ErrorLevel != 0
  {
   goto, Click
  }
return
 
 
;------Secret GIft------
 
SecretChest:
gosub, RandomWait
 PixelSearch, Px, Py, 300, 390, 300, 550, 0x0F5CAB, 1, Fast
  If ErrorLevel = 0
   {
     goto, SChestCheck
    return
   }
 PixelSearch, Px, Py, 300, 390, 300, 550, 0x0F5CAB, 1, Fast
  If ErrorLevel != 0
   {
    PixelGetColor, color, 110, 511, %AppVer% ;Secret GIft
    SC1 = %color%
    sleep, 1000
    PixelGetColor, color, 110, 511, %AppVer% ;Secret GIft
    SC2 = %color%
     If SC1 != %SC2%
      {
       ControlClick, x110 y510, %AppVer% ;select Secret Chest
       goto, SecretChest
      }
     If SC1 = %SC2%
      {
       return
      }
   }
return
 
SChestCheck:
gosub, RandomWait
PixelGetColor, color, 200, 400, %AppVer% 
 If Color = 0x0F5CAB
  {
   ControlClick, x200 y400, %AppVer% ;Collect
   goto, SChestCheck
  }
PixelGetColor, color, 200, 420, %AppVer% 
 If Color = 0x0F5CAB
  {
   ControlClick, x200 y420, %AppVer% ;Collect
   goto, SChestCheck
  }
return
 
AthenaChest:
toggle := 0
gosub, TimersOff
PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
 AC1 = %color%
   sleep, 1000
PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
 AC2 = %color%
   sleep, 1000
 If AC1 != %AC2%
  {
   ControlClick, x190 y510, %AppVer% ;select Secret Chest
      sleep, 1000
   PixelSearch, Px, Py, 300, 390, 300, 550, 0x0F5CAB, 1, Fast
    If ErrorLevel = 0
     {
      goto, AthenaChestCheck
      return
     }
 else
  goto, AthenaChest
  return
  }
 
AthenaChestCheck:
   sleep, 1000
   PixelSearch, Px, Py, 165, 350, 350, 500, 0x0F5CAB, 0, Fast
    If ErrorLevel = 0
     {
      ControlClick, x%Px% y%Py%, %AppVer% ;Collect
      goto, AthenaChestCheck
      return
     }
PixelGetColor, color, 200, 400, %AppVer% 
 If Color = 0x0F5CAB
  {
   ControlClick, x200 y400, %AppVer% ;Collect
   goto, AthenaChestCheck
   return
  }
PixelGetColor, color, 200, 420, %AppVer% 
 If Color = 0x0F5CAB
  {
   ControlClick, x200 y420, %AppVer% ;Collect
   goto, AthenaChestCheck
   return
  }
sleep, 2000
return
 
RestartDroidFail:
 
PixelGetColor, color, 900, 775, %AppVer%
 If (Color != 0x000000) ;Launch Droid Check
  {
   return
  }
PixelGetColor, color, 900, 775, %AppVer%
 If (Color = 0x000000) ;Launch Droid Check
  {
   gosub, SizeCheck
   ControlClick, x95 y353, %AppVer% ;select GoW Icon
   sleep, 5000
  }
   PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x420 y120, %AppVer% ;Close Summer Sale Pack
      sleep, 1000
  }
 
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y55, %AppVer% ;Close Legendary Hero Gear Pack
      sleep, 1000
  }
 
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y160, %AppVer% ;Close Legendary Hero Gear Pack
      sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y160, %AppVer% ;Close Legendary Hero Gear Pack
      sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x410 y130, %AppVer% ;Close Button Research Pack
      sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y50, %AppVer% ;Close Monster Sale Pack
      sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y53, %AppVer% ;Close Button Minotaur Pack
      sleep, 1000
  }
PixelSearch, Px, Py, 310, 580, 330, 640, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   goto, RestartDroidFail
   return
  }
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, resize
   goto, RestartDroidFail
   return
  }
goto, cyclesubs
return
 
xAthenaChest:
toggle := 0
gosub, TimersOff
   PixelSearch, Px, Py, 165, 350, 350, 500, 0x0F5CAB, 0, Fast
    If ErrorLevel != 0
     {
      PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
       AC1 = %color%
      ControlClick, x190 y510, %AppVer% ;select Secret Chest
       sleep, 2000
       PixelSearch, Px, Py, 320, 132, 420, 600, 0x474100, 0, Fast
        If ErrorLevel = 0
         {
          gosub, cityscreen
          return
         }
      PixelGetColor, color, 190, 505, %AppVer% ;Secret GIft
      AC2 = %color%
      If AC1 = %AC2%
      {
       gosub, AthenaChest
       return
      }
   PixelSearch, Px, Py, 165, 350, 350, 500, 0x0F5CAB, 0, Fast
    If ErrorLevel = 0
     {
      ControlClick, x%Px% y%Py%, %AppVer% ;Collect
         sleep, 1000
      return
     }
     }
return
 
xAthenaChestCheck:
   sleep, 1000
   PixelSearch, Px, Py, 165, 350, 350, 500, 0x0F5CAB, 0, Fast
    If ErrorLevel = 0
     {
      ControlClick, x%Px% y%Py%, %AppVer% ;Collect
      goto, AthenaChestCheck
     }
PixelGetColor, color, 200, 400, %AppVer% 
 If Color = 0x0F5CAB
  {
   ControlClick, x200 y400, %AppVer% ;Collect
   goto, AthenaChestCheck
  }
PixelGetColor, color, 200, 420, %AppVer% 
 If Color = 0x0F5CAB
  {
   ControlClick, x200 y420, %AppVer% ;Collect
   goto, AthenaChestCheck
  }
return
 
;------Alliance City Functions------
 
AllianceCityQuest:
;Continued Code Required
PixelSearch, Px, Py, 445, 550, 445, 550, 0X282EA0, 10, Fast, %AppVer% ;Alliance Help
 If ErrorLevel = 0
  {
   gosub, HelpIcon
   SetTimer, CityScreen, Off
   sleep, 3000
  }
{
 gosub, AllianceCityQuest
 sleep, 3000
   }
return
 
;------Quests------
 
QuestHome:
 
PixelSearch, Px, Py, 150, 250, 350, 550, 0x474100, 0, Fast 
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer% ;select Convert
      sleep, 1000
   goto, QuestHome
  }
 
PixelGetColor, color, 200, 490, %AppVer% 
 If Color = 0x030839
  {
   ControlClick, x200 y490, %AppVer% ;Collect
      sleep, 1000
   goto, QuestHome
   return
  }
PixelSearch, Px, Py, 65, 110, 450, 110, 0x0F5CAB, 0, Fast ;Buy Gold button
    sleep, 1000
 If ErrorLevel != 0
  {
   ControlClick, x170 y700, %AppVer% ;select Quest Tab
      sleep, 1000
   goto, QuestHome
  }
 
return
 
Quests:
IfWinExist, %AppVer%
 WinActivate
   sleep, 1000
gosub, QuestHome
sleep, 3000
ControlClick, x404 y322, %AppVer% ;select Daily Quest Tab
sleep, 3000
gosub, DQ1
sleep, 3000
ControlClick, x404 y438, %AppVer% ;select Alliance Quest Tab
sleep, 3000
gosub, DQ1
sleep, 3000
ControlClick, x404 y554, %AppVer% ;select VIP Quest Tab
sleep, 3000
PixelSearch, Px, Py, 300, 385, 400, 385, 0x0F5CAB, 1, Fast 
 If ErrorLevel = 0
  {
   ControlClick, x410 y150, %AppVer% ;select Close VIP Quest
   sleep, 1000
   gosub, VQ1
  }
 Else
  {
   gosub, VQ1
   return
  }
gosub, CityScreen
return
 
QuestCheck:
GuiControlGet, AccountQ, 2:
IfWinExist, %AppVer%
 WinActivate
   sleep, 1000
gosub, QuestHome
   sleep, 3000
 
PixelSearch, Px, Py, 404, 206, 414, 206, 0x0CD500, 100, Fast 
 If ErrorLevel = 0
  {
   ControlClick, x404 y206, %AppVer% ;select Empire Quest Tab
   gosub, RandomWait
   gosub, EQ1
   sleep, 4000
  }
 
PixelSearch, Px, Py, 404, 322, 414, 322, 0x0CD500, 100, Fast 
 If ErrorLevel = 0
  {
   ControlClick, x404 y322, %AppVer% ;select Daily Quest Tab
   gosub, RandomWait
   gosub, DQ1
   sleep, 4000
  }
 
PixelSearch, Px, Py, 404, 438, 414, 438, 0x0CD500, 100, Fast 
 If ErrorLevel = 0
  {
   ControlClick, x404 y438, %AppVer% ;select Alliance Quest Tab
   gosub, RandomWait
   gosub, DQ1
   sleep, 4000
  }
 
PixelSearch, Px, Py, 404, 554, 414, 560, 0x0CD500, 100, Fast 
 If ErrorLevel = 0
  {
   ControlClick, x404 y554, %AppVer% ;select VIP Quest Tab
   sleep, 2000
   PixelSearch, Px, Py, 300, 385, 400, 385, 0x0F5CAB, 1, Fast 
    If ErrorLevel = 0
     {
      ControlClick, x410 y150, %AppVer% ;select Close VIP Quest
      gosub, RandomWait
      gosub, VQ1
     }
   PixelSearch, Px, Py, 420, 230, 420, 230, 0x002C00, 0, Fast 
    If ErrorLevel = 0
    {
     gosub, VQ1
     sleep, 4000
    }
   PixelSearch, Px, Py, 420, 230, 420, 230, 0x474100, 0, Fast 
    If ErrorLevel = 0
    {
     gosub, VQ1
     sleep, 4000
    }
  }
gosub, CityScreen
return
 
QuestChance:
PixelGetColor, color, 375, 580, %AppVer% ;Chance
 If Color = 0x0F5CAB
  {
   ControlClick, x375 y580, %AppVer% ;Chance
   gosub, RandomWait
   PixelGetColor, color, 300, 310, %AppVer% ;Use
   If Color = 0x002C00
    {
     ControlClick, x300 y310, %AppVer% ;Use
     gosub, RandomWait
    }
   PixelGetColor, color, 300, 310, %AppVer% ;Use
    If Color = 0x001600
     {
      ControlClick, x410 y150, %AppVer% ;Close
      gosub, RandomWait
      ControlClick, x170 y700, %AppVer% ;Quests Tab
      gosub, RandomWait
      PixelSearch, Px, Py, 420, 220, 420, 220, 0xA2B3C2, 100, Fast ;Buy Gold button
       If ErrorLevel = 0
        {
         ControlClick, x170 y700, %AppVer% ;Quests Tab
         return
        }
     }
  }
return
 
EQ1:
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, RestartDroidFail
  }
PixelSearch, Px, Py, 310, 400, 310, 400, 0x424447, 0, Fast
 If ErrorLevel = 0
  {
   sleep, 1000
   goto, EQ1
   return
  }
PixelSearch, Px, Py, 430, 275, 430, 275, 0x424447, 0, Fast
 If ErrorLevel = 0
  {
   sleep, 1000
   goto, EQ1
   return
  }
 
PixelSearch, Px, Py, 430, 160, 430, 160, 0x424447, 0, Fast ;Recommended Row (Gray)
 If ErrorLevel = 0
  {
   gosub, RandomWait
   goto, EQ1
   return
  }
 
PixelSearch, Px, Py, 200, 550, 200, 550, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x200 y550, %AppVer% ;select Collect
   goto, EQ1
   return
  }
 
 
PixelSearch, Px, Py, 310, 400, 310, 400, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x310 y400, %AppVer% ;select Collect
   goto, EQ1
   return
  }
PixelSearch, Px, Py, 430, 275, 430, 275, 0x002C00, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y275, %AppVer% ;select Collect
   goto, EQ1
   return
  }
PixelSearch, Px, Py, 430, 160, 430, 160, 0x002C00, 0, Fast ;Recommended Row
 If ErrorLevel = 0
  {
   ControlClick, x430 y160, %AppVer% ;select Collect
   goto, EQ1
   return
  }
 
PixelSearch, Px, Py, 320, 600, 320, 600, 0x424447, 0, Fast
 If ErrorLevel != 0
  {
   ControlClick, x170 y700, %AppVer% ;select Collect
   return
  }
PixelSearch, Px, Py, 150, 50, 150, 50, 0x101427, 50, Fast
 If ErrorLevel != 0
  {
   return
  }
   sleep, 1000
PixelSearch, Px, Py, 65, 110, 450, 110, 0x0F5CAB, 0, Fast ;Buy Gold button
   sleep, 1000
 If ErrorLevel = 0
  {
   ControlClick, x350 y200, %AppVer% ;select Empire Quest Tab
   goto, EQ1
   return
  }
PixelGetColor, color, 190, 550, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x190 y550, %AppVer%
   gosub, RandomWait
   goto, EQ1
   return
  }
PixelGetColor, color, 430, 160, %AppVer% 
 If Color = 0x002C00
  {
   ControlClick, x430 y160, %AppVer%
   gosub, RandomWait
   goto, EQ1
   return
  }
PixelGetColor, color, 430, 280, %AppVer% 
 If Color = 0x002C00
  {
   ControlClick, x430 y280, %AppVer%
   gosub, RandomWait
   goto, EQ1
   return
  }
PixelGetColor, color, 120, 550, %AppVer% ;Hero Level Up
 If Color = 0X474100
  {
   ControlClick, x120 y550, %AppVer% ;Close Button
   goto, EQ1
   return
  }
 
PixelGetColor, color, 430, 160, %AppVer% ;EQ1 End Sting
 If Color != 0x002C00
  {
   PixelGetColor, color, 430, 280, %AppVer% 
    If Color != 0x002C00
     {
      ControlClick, x170 y700, %AppVer% ;Quests Tab
      return
     }
  }
Return
 
DQ1:
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, RestartDroidFail
  }
   gosub, RandomWait
PixelSearch, Px, Py, 310, 400, 310, 400, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x310 y400, %AppVer% ;select Collect
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelSearch, Px, Py, 150, 50, 150, 50, 0x101427, 50, Fast
 If ErrorLevel != 0
  {
   return
  }
PixelGetColor, color, 425, 190, %AppVer%
 If (Color = 0x000429)
  {
   If (AccountQ = 1)
    {
     gosub, AllTimersOff
     gosub, QuestChance
     gosub, RandomWait
     goto, DQ1
     return
    }
   If (AccountQ = 0)
    {
     ControlClick, x170 y700, %AppVer% ;Quests Tab
    }
  }
GuiControlGet, AccountQ, 2:
gosub, RandomWait
PixelGetColor, color, 425, 190, %AppVer% ;Sleep String
 If (Color = 0x424447 or Color = 0x3E3800)
  {
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 190, 550, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x190 y550, %AppVer%
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 200, 490, %AppVer% ;Alliance Check
 If Color = 0x030839
  {
   ControlClick, x200 y490, %AppVer%
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 430, 190, %AppVer% 
 If (Color = 0x474100 or Color = 0x002C00)
  {
   ControlClick, x430 y190, %AppVer%
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 407, 194, %AppVer% 
 If Color = 0x788FA2
  {
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 425, 180, %AppVer% 
 If (Color = 0x474100 or Color = 0x002C00)
  {
   ControlClick, x425 y180, %AppVer%
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 430, 190, %AppVer% 
 If Color = 0x000429
  {
   If (AccountQ = 1)
    {
     gosub, QuestChance
     gosub, RandomWait
     goto, DQ1
     return
    }
   If (AccountQ = 0)
    {
     ControlClick, x170 y700, %AppVer% ;Quests Tab
    }
  }
PixelSearch, Px, Py, 420, 220, 420, 220, 0xA2B3C2, 100, Fast ;Buy Gold button
  If ErrorLevel = 0
   {
    ControlClick, x170 y700, %AppVer% ;Quests Tab
    return
   }
 
PixelGetColor, color, 300, 375, %AppVer% 
 If (Color = 0x0F5CAB)
  {
   ControlClick, x300 y375, %AppVer%
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 200, 500, %AppVer% ;Hero Level Up
 If Color = 0x474100
  {
   ControlClick, x200 y500, %AppVer%
   gosub, RandomWait
   goto, DQ1
   return
  }
PixelGetColor, color, 300, 310, %AppVer% ;Use
 If Color = 0x002C00
  {
   ControlClick, x300 y310, %AppVer% ;Use
   gosub, RandomWait
   goto, DQ1
  }
PixelGetColor, color, 300, 310, %AppVer% ;Use
 If Color = 0x001600
  {
   ControlClick, x410 y150, %AppVer% ;Close
   gosub, RandomWait
   goto, DQ1
  }
return
 
VQ1:
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, RestartDroidFail
  }
gosub, RandomWait
PixelSearch, Px, Py, 310, 400, 310, 400, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x310 y400, %AppVer% ;select Collect
   goto, VQ1
   return
  }
PixelSearch, Px, Py, 150, 50, 150, 50, 0x101427, 50, Fast
 If ErrorLevel != 0
  {
   return
  }
GuiControlGet, AccountQ, 2:
PixelGetColor, color, 407, 194, %AppVer% 
 If Color = 0x788FA2
  {
   goto, VQ1
   return
  }
PixelGetColor, color, 190, 550, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x190 y550, %AppVer%
   goto, VQ1
   return
  }
PixelGetColor, color, 425, 225, %AppVer% 
 If (Color = 0x474100 or Color = 0x002C00)
  {
   ControlClick, x425 y225, %AppVer%
   goto, VQ1
   return
  }
PixelSearch, Px, Py, 420, 220, 420, 220, 0xA2B3C2, 100, Fast ;Buy Gold button
  If ErrorLevel = 0
   {
    ControlClick, x100 y700, %AppVer% ;City Tab
    return
   }
PixelGetColor, color, 300, 375, %AppVer% 
 If (Color = 0x000429)
  {
   If (AccountQ = 1)
    {
     SetTimer, CityScreen, off
     gosub, QuestChance
     goto, VQ1
     return
    }
   If (AccountQ = 0)
    {
     gosub, RandomWait
    }
  }
 
PixelGetColor, color, 300, 375, %AppVer% 
 If (Color = 0x0F5CAB)
  {
   ControlClick, x300 y375, %AppVer%
   goto, VQ1
   return
  }
PixelGetColor, color, 200, 500, %AppVer% ;Hero Level Up
 If Color = 0x474100
  {
   ControlClick, x200 y500, %AppVer%
   goto, VQ1
   return
  }
PixelGetColor, color, 425, 225, %AppVer% 
 If (Color = 0x000429)
  {
   ControlClick, x100 y700, %AppVer% ;City Tab
   return
  }
PixelSearch, Px, Py, 405, 265, 425, 275, 0xA3B4C2, 100, Fast ;Tan button field
 If ErrorLevel = 0
  {
   ControlClick, x100 y700, %AppVer% ;City Tab
   return
  }
PixelGetColor, color, 300, 310, %AppVer% ;Use
 If Color = 0x002C00
  {
   ControlClick, x300 y310, %AppVer% ;Use
   goto, VQ1
  }
PixelGetColor, color, 300, 310, %AppVer% ;Use
 If Color = 0x001600
  {
   ControlClick, x410 y150, %AppVer% ;Close
   goto, VQ1
  }
gosub, RandomWait
return
 
;------Dungeon------
 
Dungeon1:
IfWinExist, %AppVer%
 WinActivate
gosub, InactivityX1
SetTimer, InactivityX2, 120000
toggle := 0
gosub, TimersOff
gosub, RandomWait
PixelSearch, Px, Py, 425, 170, 425, 170, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   gosub, CityScreen
   return
  }
PixelGetColor, color, 350, 575, %AppVer% ;
 If Color != 0x0F5CAB
  {
   goto, DungeonMenu
   return
  }
return
 
DungeonMenu:
gosub, MoreMenu
sleep, 4000
gosub, DungeonMenuWait
sleep, 4000
gosub, MoreDungeonWait1
sleep, 4000
gosub, MoreDungeonWait2
sleep, 4000
goto, DungeonSub
return
 
DungeonSub:
IfWinExist, %AppVer%
 WinActivate
toggle := 0
gosub, TimersOff
PixelSearch, Px, Py, 120, 190, 400, 550, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer%
   sleep, 4000
   goto, DungeonSub
  }
PixelGetColor, color, 360, 360, %AppVer% ;Gold Max Attack Mode Button
 If Color = 0x0F5CAB
  {
   gosub, CityScreen
   sleep, 4000
   return
  }
PixelGetColor, color, 350, 575, %AppVer% ;Gold Max Attack Mode Button
 If Color = 0x0F5CAB
  {
   ControlClick, x250 y300, %AppVer% ;Monster Image
   PixelGetColor, color, 365, 565, %AppVer% ;Gold Max Attack Mode Button
    If Color = 0x0F5CAB
     {
      gosub, CityScreen
      sleep, 4000
      return
     }
  }
PixelGetColor, color, 350, 575, %AppVer% ;Gold Max Attack Mode Button
 If Color != 0x0F5CAB
  {
   gosub, DungeonSplashCheck
   goto, DungeonTreasureCheck
   return
  }
return
 
DungeonSplashCheck:
WinGetPos,X,Y,W,H,A
 If w != 460
  {
   gosub, RestartDroidFail
  }
 
PixelSearch, Px, Py, 120, 190, 400, 550, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer%
   sleep, 2000
   goto, DungeonSub
  }
PixelSearch, Px, Py, 416, 35, 450, 58, 0xDCDCDC, 10, Fast
 If ErrorLevel = 0
  {
   ControlClick, x435 y50, %AppVer% ;Get Gold Splash Close
   gosub, RandomWait
   gosub, CityScreen
   return
  }
PixelSearch, Px, Py, 400, 147, 420, 163, 0xDCDCDC, 50, Fast ;Close
 If ErrorLevel = 0
  {
   ControlClick, x410 y150, %AppVer%
   gosub, RandomWait
  }
PixelSearch, Px, Py, 300, 240, 300, 240, 0x474100, 50, Fast ;Dungeon Close Notice
 If ErrorLevel = 0
  {
   ControlClick, x300 y240, %AppVer%
   gosub, RandomWait
  }
return
 
DungeonTreasureCheck:
IfWinExist, %AppVer%
 WinActivate
sleep, 3000
PixelSearch, Px, Py, 350, 575, 350, 575, 0x0F5CAB, 0, Fast ;Gold Max Attack Mode Button
 If ErrorLevel = 0
  {
   gosub, CityScreen
   return
  }
PixelSearch, Px, Py, 350, 575, 350, 575, 0x031222, 10, Fast ;Dark Max Attack Button
 If ErrorLevel = 0
  {
   goto, ThreeChestRandom
  }
PixelSearch, Px, Py, 125, 165, 125, 165, 0x0E4E8C, 50, Fast ;Chest 1 of 25
 If ErrorLevel = 0
  {
   PixelSearch, Px, Py, 400, 460, 400, 460, 0x0E4E8C, 50, Fast ;Chest 25 of 25
    If ErrorLevel = 0
     {
      goto, TwentyFiveChestRandom
     }
  }
return
 
ThreeChestRandom:
gosub, ChestCollect
PixelGetColor, color, 300, 575, %AppVer%
 If Color != 0x0F5CAB
  {
   Random, n, 1, 3
   If n = 1
    ControlClick, x150 y400, %AppVer% ;First Chest
   If n = 2
    ControlClick, x250 y400, %AppVer% ;Second Chest
   If n = 3
    ControlClick, x350 y400, %AppVer% ;Third Chest
   sleep, 3000
  }
PixelSearch, Px, Py, 160, 470, 357, 493, 0x0F5CAB, 3, Fast ;Collect Random
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer% ;Collect Random
   gosub, RandomWait
   goto, ChestCollect
  }
 
PixelGetColor, color, 300, 575, %AppVer% ;Collect Loop
 If Color != 0x0F5CAB
  {
   goto, ThreeChestRandom
  }
PixelGetColor, color, 300, 575, %AppVer% ;Finish Dungeon
 If Color = 0x0F5CAB
  {
   gosub, CityScreen
  }
return
 
TwentyFiveChestRandom:
gosub, ChestCollect
PixelGetColor, color, 300, 575, %AppVer%
 If Color != 0x0F5CAB
  {
 
   Random, n, 1, 25
   If n = 1
    ControlClick, x125 y165, %AppVer%
   If n = 2
    ControlClick, 190, y165, %AppVer%
   If n = 3
    ControlClick, 260, y165, %AppVer%
   If n = 4
    ControlClick, 330, y165, %AppVer%
   If n = 5
    ControlClick, x400 y165, %AppVer%
   If n = 6
    ControlClick, x125 y240, %AppVer%
   If n = 7
    ControlClick, x190 y240, %AppVer%
   If n = 8
    ControlClick, x260 y240, %AppVer%
   If n = 9
    ControlClick, x330 y240, %AppVer%
   If n = 10
    ControlClick, x400 y240, %AppVer%
   If n = 11
    ControlClick, x125 y315, %AppVer%
   If n = 12
    ControlClick, x190 y315, %AppVer%
   If n = 13
    ControlClick, x260 y315, %AppVer%
   If n = 14
    ControlClick, x330 y315, %AppVer%
   If n = 15
    ControlClick, x400 y315, %AppVer%
   If n = 16
    ControlClick, x125 y390, %AppVer%
   If n = 17
    ControlClick, x190 y390, %AppVer%
   If n = 18
    ControlClick, x260 y390, %AppVer%
   If n = 19
    ControlClick, x330 y390, %AppVer%
   If n = 20
    ControlClick, x400 y390, %AppVer%
   If n = 21
    ControlClick, x125 y460, %AppVer%
   If n = 22
    ControlClick, x190 y460, %AppVer%
   If n = 23
    ControlClick, x260 y460, %AppVer%
   If n = 24
    ControlClick, x330 y460, %AppVer%
   If n = 25
    ControlClick, x400 y460, %AppVer%
   sleep, 3000
  }
PixelGetColor, color, 350, 575, %AppVer% ;Collect Loop
 If Color != 0x0F5CAB
  {
   goto, TwentyFiveChestRandom
  }
PixelGetColor, color, 350, 575, %AppVer% ;Finish Dungeon
 If Color = 0x0F5CAB
  {
   gosub, CityScreen
  }
return
 
 
ChestCollect:
sleep, 5000
PixelGetColor, color, 350, 575, %AppVer% ;Finish Dungeon
 If Color = 0x0F5CAB
  {
   gosub, CityScreen
   return
  }
 
PixelGetColor, color, 350, 430, %AppVer% ;Collect Button
 If Color = 0x0F5CAB
  {
   ControlClick, x350 y430, %AppVer%
   sleep, 2000
   goto, ChestCollect
  }
PixelGetColor, color, 350, 465, %AppVer% ;Collect Button
 If Color = 0x0F5CAB
  {
   ControlClick, x350 y465, %AppVer%
   sleep, 2000
   goto, ChestCollect
  }
PixelGetColor, color, 350, 450, %AppVer% ;Collect Button
 If Color = 0x0F5CAB
  {
   ControlClick, x350 y450, %AppVer%
   sleep, 2000
   goto, ChestCollect
  }
return
 
;GoW Automation End Part 2 of 3


Ragjr2003
  • Members
  • 9 posts
  • Last active: Oct 25 2015 03:01 PM
  • Joined: 06 Oct 2015
;GoW Automation Part 3 of 3
 
;------Inventory Functions------
 
ResearchMenuWait:
sleep, 3000
PixelSearch, Px, Py, 280, 160, 280, 160, 0x030839, 3, Fast
 If ErrorLevel != 0
  {
   ControlClick, x225 y475, %AppVer% ;Research Menu Icon
   goto, ResearchMenuWait
  }
   ResearchCounter++
return
 
MoreMenu:
IfWinExist,  %AppVer%
 WinActivate
sleep, 2000
PixelSearch, Px, Py, 310, 220, 320, 230, 0x4AA722, 10, Fast ; Green "MZ Logo" on More Menu
 If ErrorLevel != 0
  {
   ControlClick, x425 y700,  %AppVer% ;More Menu Icon Location
   sleep, 1000
   goto, MoreMenu
   return
  }
return
 
ItemsMenu:
If (toggleCh = false)
 {
  return
 }
   gosub, RandomWait
PixelSearch, Px, Py, 375, 50, 375, 50, 0x010427, 5, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y50, %AppVer% ;select Items
   sleep, 2000
   goto, ItemsMenu
  }
PixelSearch, Px, Py, 80, 165, 435, 165, 0x90A8B6, 5, Fast
 If ErrorLevel != 0
  {
   ControlClick, x230 y700, %AppVer% ;select Items
   gosub, RandomWait
   goto, ItemsMenu
  }
return
 
MyItemsMenu:
If (toggleCh = false)
 {
  return
 }
   gosub, RandomWait
PixelSearch, Px, Py, 375, 50, 375, 50, 0x010427, 5, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y50, %AppVer% ;select Items
   sleep, 2000
   gosub, ItemsMenu
   sleep, 2000
   goto, MyItemsMenu
  }
PixelSearch, Px, Py, 300, 175, 300, 175, 0xFFFFFF, 5, Fast
 If ErrorLevel = 0
  {
   gosub, ItemsMenu
   sleep, 2000
   goto, MyItemsMenu
  }
PixelSearch, Px, Py, 300, 175, 300, 175, 0x8FA7B5, 5, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 300, 175, 300, 175, 0x8FA7B5, 5, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 300, 175, 300, 175, 0x8FA7B5, 5, Fast
 If ErrorLevel != 0
  {
   ControlClick, x300 y175, %AppVer% ;select My Items
   gosub, RandomWait
   goto, MyItemsMenu
  }
return
 
TreasureItemsMenu:
If (toggleCh = false)
 {
  return
 }
   gosub, RandomWait
PixelSearch, Px, Py, 430, 235, 430, 235, 0x07096A, 3, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 430, 235, 430, 235, 0x07096A, 3, Fast
 If ErrorLevel != 0
  {
   ControlClick, x430 y225, %AppVer% ;select Treasures
   gosub, RandomWait
   goto, TreasureItemsMenu
  }
return
 
ForgeMenu:
IfWinExist,  %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CityScreen
  return
 }
sleep, 2000
PixelSearch, Px, Py, 330, 540, 330, 540, 0x474100, 0, Fast ;More Information Button Forge screen
 If ErrorLevel != 0
  {
   ControlClick, x405 y405,  %AppVer% ;Train Menu Icon location in More Menu
   sleep, 1000
   goto, ForgeMenu
   return
  }
return
 
CombineMenu:
IfWinExist,  %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CityScreen
  return
 }
sleep, 2000
PixelSearch, Px, Py, 180, 580, 180, 580, 0x474100, 0, Fast ;Information Button Combine screen
 If ErrorLevel != 0
  {
   ControlClick, x105 y330,  %AppVer% ;Train Menu Icon location in More Menu
   sleep, 1000
   goto, CombineMenu
   return
  }
return
 
CoresTab:
IfWinExist,  %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CityScreen
  return
 }
sleep, 2000
PixelSearch, Px, Py, 145, 220, 145, 220, 0x90A8B6, 10, Fast ;Cores Tab Combine screen
 If ErrorLevel != 0
  {
   ControlClick, x145 y220,  %AppVer% ;Cores Tab
   sleep, 1000
   goto, CoresTab
   return
  }
return
 
PiecesTab:
IfWinExist,  %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CityScreen
  return
 }
sleep, 2000
PixelSearch, Px, Py, 245, 220, 245, 220, 0x90A8B6, 10, Fast ;Pieces Tab Combine screen
 If ErrorLevel != 0
  {
   ControlClick, x245 y220,  %AppVer% ;Pieces Tab
   sleep, 1000
   goto, PiecesTab
   return
  }
return
 
GemsTab:
IfWinExist,  %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CityScreen
  return
 }
sleep, 2000
PixelSearch, Px, Py, 341, 220, 341, 220, 0x90A8B6, 10, Fast ;Gems Tab Combine screen
 If ErrorLevel != 0
  {
   ControlClick, x341 y220,  %AppVer% ;Gems Tab
   sleep, 1000
   goto, GemsTab
   return
  }
return
 
MaterialsTab:
IfWinExist,  %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CityScreen
  return
 }
sleep, 2000
PixelSearch, Px, Py, 435, 220, 435, 220, 0x90A8B6, 10, Fast ;Materials Tab Combine screen
 If ErrorLevel != 0
  {
   ControlClick, x435 y220,  %AppVer% ;Materials Tab
   sleep, 1000
   goto, MaterialsTab
   return
  }
return
 
 
 
DungeonMenuWait:
PixelSearch, Px, Py, 250, 150, 250, 150, 0xC8E0EA, 5, Fast
 If ErrorLevel != 0
  {
   ControlClick, x115 y315, %AppVer%
   goto, DungeonMenuWait
  }
return
 
MoreDungeonWait1:
gosub, RandomWait
PixelSearch, Px, Py, 120, 190, 400, 550, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer%
   sleep, 3000
   goto, MoreDungeonWait1
  }
return
 
MoreDungeonWait2:
PixelSearch, Px, Py, 300, 380, 300, 380, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x300 y380, %AppVer% ;select Items
   sleep, 2000
   goto, MoreDungeonWait2
   return
  }
PixelSearch, Px, Py, 300, 510, 300, 510, 0x474100, 10, Fast
 If ErrorLevel = 0
  {
   ControlClick, x300 y510, %AppVer% ;select Items
   sleep, 2000
   goto, MoreDungeonWait2
   return
  }
PixelSearch, Px, Py, 120, 190, 400, 550, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer%
   sleep, 2000
   goto, MoreDungeonWait2
  }
return
 
ItemsWait:
   gosub, RandomWait
PixelSearch, Px, Py, 375, 50, 375, 50, 0x010427, 5, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y50, %AppVer% ;select Items
   sleep, 2000
   goto, ItemsWait
  }
PixelSearch, Px, Py, 80, 165, 435, 165, 0x90A8B6, 5, Fast
 If ErrorLevel != 0
  {
   ControlClick, x230 y700, %AppVer% ;select Items
   gosub, RandomWait
   goto, ItemsWait
  }
return
 
 
StoreWait:
   gosub, RandomWait
PixelSearch, Px, Py, 90, 175, 90, 175, 0x8EA6B4, 5, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 90, 175, 90, 175, 0x8EA6B4, 5, Fast
 If ErrorLevel != 0
  {
   ControlClick, x90 y175, %AppVer% ;select My Items
   gosub, RandomWait
   goto, StoreWait
  }
return
 
WarItemsWait:
   gosub, RandomWait
PixelSearch, Px, Py, 320, 250, 320, 250, 0x07096C, 5, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 320, 250, 320, 250, 0x07096C, 5, Fast
 If ErrorLevel != 0
  {
   ControlClick, x320 y250, %AppVer% ;select War
   gosub, RandomWait
   goto, WarItemsWait
  }
return
 
;------Combine------
 
BeginCombine:
IfWinExist, Droid4X 0.8.3 Beta
 WinActivate
gosub, CombineTabSelect
Gui 1:Submit, NoHide
GuiControlGet, CombineTabSelect, 1:
  sleep, 1000
  gosub, Resize
  sleep, 1000
  PixelSearch, Px, Py, 180, 580, 180, 580, 0x474100, 0, Fast ;Information Button Combine screen
   If ErrorLevel != 0
    {
     PixelSearch, Px, Py, 440, 580, 440, 580, 0x474100, 0, Fast ;Information Button Combine screen
     If ErrorLevel != 0
      {
       gosub, CityScreen
       sleep, 1000
       gosub, MoreMenu
       sleep, 1000
       gosub, ForgeMenu
       sleep, 1000
       gosub, CombineMenu
       sleep, 1000
      }
    }
If (SelectCombineTab = 1)
 {
  gosub, CoresTab
 }
If (SelectCombineTab = 2)
 {
  gosub, PiecesTab
 }
If (SelectCombineTab = 3)
 {
  gosub, GemsTab
 }
If (SelectCombineTab = 4)
 {
  gosub, MaterialsTab
 }
sleep, 1000
gosub, CombineMoveUp
sleep, 500
SetTimer, Slot4R3, 3000
return
 
CombineMoveUp:
SetDefaultMouseSpeed, 25
IfWinExist, %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CityScreen
  return
 }
 
SendEvent {Click 370, 475, down}
gosub, RandomWait
SendEvent {click 370, 100, up}
PixelSearch, Px, Py, 125, 500, 125, 500, 0x121212, 3, Fast ;Black background at bottom of combine
 If ErrorLevel = 0
  {
   PixelSearch, Px, Py, 425, 510, 425, 510, 0x121212, 3, Fast ;Black background at bottom of combine
    If ErrorLevel = 0
     {
      gosub, RandomWait
      goto, CombineMoveDown
      return
     }
  }
gosub, RandomWait
goto, CombineMoveUp
return
 
CombineMoveDown:
SetDefaultMouseSpeed, 25
IfWinExist, %AppVer%
 WinActivate
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
SendEvent {click 370, 300, down}
gosub, RandomWait
SendEvent {Click 370, 380, up}
gosub, RandomWait
return
 
CombineTabSelect:
 
If (CombineTab = 1)
 {
  SelectCombineTab = CoresTab
 }
If (CombineTab = 2)
 {
  SelectCombineTab = PiecesTab
 }
If (CombineTab = 3)
 {
  SelectCombineTab = GemsTab
 }
If (CombineTab = 4)
 {
  SelectCombineTab = MaterialsTab
 }
Gui 1:Submit, nohide
return
 
CombineDone:
IfWinExist, %AppVer%
 WinActivate
toggleCm := 0
SetTimer, Slot4R3, off
sleep, 500
goto, CityScreen
return
 
CombineCheck:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x474100
    {
     ControlClick, x300 y580, %AppVer%
     goto, CombineCheck
     return
    }
PixelGetColor, color, 230, 270, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x230 y270, %AppVer%
   goto, CombineCheck
   return
  }
PixelGetColor, color, 230, 340, %AppVer% 
 If Color = 0x474100
    {
     ControlClick, x230 y340, %AppVer%
     goto, CombineCheck
     return
    }
PixelGetColor, color, 230, 315, %AppVer% 
 If Color = 0x474100
    {
     ControlClick, x230 y315, %AppVer%
     goto, CombineCheck
     return
    }
PixelGetColor, color, 345, 590, %AppVer% 
 If Color = 0x424447
  {
   sleep, 500
   CombineFinish := 0
   goto, CombineCheck
   return
  }
CombineFinish := 0
goto, CombineCheck2
return
 
CombineCheck2:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
sleep, 1000
PixelGetColor, color, 345, 590, %AppVer% 
 If Color = 0x424447
  {
   sleep, 500
   goto, CombineCheck2
   return
  }
PixelGetColor, color, 230, 340, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x230 y340, %AppVer%
   goto, CombineCheck2
   return
  }
PixelSearch, Px, Py, 410, 210, 410, 210, 0xD9D9D9, 50, Fast
 If ErrorLevel = 0
  {
   ControlClick, x410 y210, %AppVer% ;Select Close
   goto, CombineCheck2
   return
  }
PixelSearch, Px, Py, 410, 225, 410, 225, 0xD9D9D9, 50, Fast
 If ErrorLevel = 0
  {
   ControlClick, x410 y225, %AppVer% ;Select Close
   goto, CombineCheck2
   return
  }
 
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
return
 
;Row 3
 
Slot4R3:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x400 y500, %AppVer% ;Slot4
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot3R3
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot3R3:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x300 y500, %AppVer% ;Slot3
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot2R3
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot2R3:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x200 y500, %AppVer% ;Slot2
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot1R3
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot1R3:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x100 y500, %AppVer% ;Slot1
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot4R2
 If Color != 0x424447
  goto, CombineCheck
return
 
;Row2
 
Slot4R2:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x400 y400, %AppVer% ;Slot4
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot3R2
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot3R2:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x300 y400, %AppVer% ;Slot3
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot2R2
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot2R2:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x200 y400, %AppVer% ;Slot2
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot1R2
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot1R2:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x100 y400, %AppVer% ;Slot1
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot4R1
 If Color != 0x424447
  goto, CombineCheck
return
 
;Row 1
 
Slot4R1:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x400 y300, %AppVer% ;Slot4
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot3R1
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot3R1:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x300 y300, %AppVer% ;Slot3
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot2R1
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot2R1:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x200 y300, %AppVer% ;Slot2
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, Slot1R1
 If Color != 0x424447
  goto, CombineCheck
return
 
Slot1R1:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
ControlClick, x100 y300, %AppVer% ;Slot1
sleep, 1000
PixelGetColor, color, 300, 580, %AppVer% 
 If Color = 0x424447
  goto, MoveMouse
 If Color != 0x424447
  goto, CombineCheck
return
 
MoveMouse:
If (toggleCm = 0)
 {
  goto, CombineDone
  return
 }
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 100, 300, down}
sleep, 1000
SendEvent {click 100, 500, up}
  PixelSearch, Px, Py, 166, 282, 166, 282, 0x121212, 2, Fast ;Black background at top of combine
   If ErrorLevel = 0
    {
     PixelSearch, Px, Py, 166, 285, 166, 285, 0x121212, 2, Fast ;Black background at top of combine
      If ErrorLevel = 0
       {
        CombineFinish++
        If (CombineFinish >= 2)
         {
          CombineFinish := 0
          goto, CombineDone
          return
         }
       }
    }
return
 
;------Open Chests------
 
ChestToggle:
IfWinExist, %AppVer%
 WinActivate
sleep, 1000
 
 If(OpenChests = 0)
  {
   OpenChests := 1
   goto, InventoryChests
 
  }
 If(OpenChests = 1)
  {
   OpenChests := 0
   goto, StopChests
  }
return
 
InventoryChests:
IfWinExist, %AppVer%
 WinActivate
 If(OpenChests = 0)
  {
   goto, StopChests
   return
  }
 If(OpenChests = 1)
  {
   gosub, resize
   gosub, RandomWait
   gosub, ItemsWait
   gosub, RandomWait
   gosub, MyItemsMenu
   gosub, RandomWait
   gosub, TreasureItemsMenu
   gosub, RandomWait
   gosub, OpenChests
  }
return
 
StopChests:
OpenChests := 0
   PixelSearch, Px, Py, 400, 215, 415, 235, 0xDCDCDC, 2, Fast
    If ErrorLevel = 0
     {
      ControlClick, x%Px% y%Py%, %AppVer% ;Select Close
      gosub, Randomwait
     }
   PixelSearch, Px, Py, 400, 215, 415, 235, 0x05052D, 2, Fast
    If ErrorLevel = 0
     {
      ControlClick, x%Px% y%Py%, %AppVer% ;Select Close
      gosub, Randomwait
     }
SetTimer, OpenChests1, off
SetTimer, OpenChests2, off
gosub, RandomWait
gosub, CityScreen
return
 
OpenChests:
IfWinExist, %AppVer%
 WinActivate
 If(OpenChests = 0)
  {
   goto, StopChests
   return
  }
PixelGetColor, color, 400, 200, %AppVer% 
 If Color = 0x002C00
  {
   gosub, OpenChests2
   SetTimer, OpenChests2, 500
  }
 else
  {
   gosub, OpenChests1
   SetTimer, OpenChests1, 500
  }
return
 
OpenChests1:
 If(OpenChests = 0)
  {
   goto, StopChests
   return
  }
gosub, RandomWait
PixelGetColor, color, 365, 390, %AppVer% 
 If Color = 0x002C00
  {
   ControlClick, x365 y390, %AppVer% ;select First Icon
   return
  }
PixelGetColor, color, 365, 523, %AppVer% 
 If Color = 0x002C00
  {
   ControlClick, x365 y523, %AppVer% ;select Second Icon
   return
  }
PixelSearch, Px, Py, 400, 215, 415, 235, 0xDCDCDC, 2, Fast
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer% ;Select Close
   return
  }
PixelSearch, Px, Py, 400, 215, 415, 235, 0x05052D, 2, Fast
 If ErrorLevel = 0
  {
   ControlClick, x%Px% y%Py%, %AppVer% ;Select Close
   return
  }
PixelSearch, Px, Py, 420, 325, 420, 325, 0x282828, 10, Fast
 If ErrorLevel = 0
  {
   goto, ChestCheck
   return
  }
return
 
ChestCheck:
PixelGetColor, color, 420, 475, %AppVer% 
 If Color = 0x002C00
  return
 Else
  goto, StopChests
return
 
OpenChests2:
 If(OpenChests = 0)
  {
   goto, StopChests
   return
  }
gosub, RandomWait
PixelGetColor, color, 365, 250, %AppVer% 
 If Color = 0x424447
  {
   gosub, RandomWait
   return
  }
PixelGetColor, color, 365, 250, %AppVer% 
 If Color = 0x002C00
  {
   ControlClick, x365 y250, %AppVer% ;select First Icon
   return
  }
PixelGetColor, color, 365, 375, %AppVer% 
 If Color = 0x002C00
  {
   ControlClick, x365 y375, %AppVer% ;select Second Icon
   return
  }
PixelGetColor, color, 365, 500, %AppVer% 
 If Color = 0x002C00
  {
   ControlClick, x365 y500, %AppVer% ;select Third Icon
   return
  }
return
 
;Alliance Change Subs
 
ChangeAllianceTag:
If varlogin = 56
 {
  gosub, AllMoveOff
  return
 }
If varlogin >56
 {
  GuiControl,,AccountMode,Moving
  gosub, TagChange
  return
 }
 
 
TagChange:
gosub, AllianceMenu
sleep, 3000
gosub, AllianceChangeChoice
gosub, RandomWait
return
 
AllianceMenu:
sleep, 4000
 
PixelSearch, Px, Py, 300, 485, 300, 485, 0x030839, 3, Fast
 If ErrorLevel = 0
  {
   ControlClick, x300 y485, %AppVer% ;Close
   goto, AllianceJoin
   return
  }
 
PixelSearch, Px, Py, 390, 225, 390, 225, 0x474100, 3, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 390, 225, 390, 225, 0x474100, 3, Fast
 If ErrorLevel != 0
  {
   ControlClick, x300 y700, %AppVer% ;Close
   goto, AllianceMenu
   return
  }
return
 
AllianceChangeChoice:
sleep, 4000
PixelGetColor, color, 300, 490, %AppVer% 
 If Color = 0x030839
  {
   ControlClick, x300 y490, %AppVer% ;Close
   goto, AllianceJoin
   return
  }
 
PixelGetColor, color, 375, 155, %AppVer% 
 If Color = 0x474100
  {
   goto, AllianceInput
   return
  }
ControlClick, x300 y700, %AppVer% ;select Alliance Menu
sleep, 4000
PixelSearch, Px, Py, 80, 120, 435, 120, 0x0F5CAB, 20, Fast
 sleep, 4000
 If ErrorLevel = 0
  {
   goto, AllianceScroll
   return
  }
 Else
  {
   sleep, 4000
   goto, AllianceMenu
   return
  }
return
 
AllianceScroll:
IfWinExist, %AppVer%
 WinActivate
   sleep, 4000
PixelGetColor, color, 300, 490, %AppVer% 
 If Color = 0x030839
  {
   goto, AllianceJoin
   return
  }
PixelGetColor, color, 350, 350, %AppVer% 
 If Color = 0x030839
  {
   ControlClick, x350 y350, %AppVer% ;Leave Alliance Button
   goto, AllianceLeave
   return
  }
SetDefaultMouseSpeed, 10
SendEvent {Click 400, 600, down}
sleep, 3000
SendEvent {click 400, 80, up}
sleep, 3000
ControlClick, x400 y600, %AppVer% ;Leave Alliance Tab
sleep, 3000
PixelGetColor, color, 350, 350, %AppVer% 
 If Color != 0x030839
  {
   goto, AllianceScroll
   return
  }
PixelGetColor, color, 350, 350, %AppVer% 
 If Color = 0x030839
  {
   ControlClick, x350 y350, %AppVer% ;Leave Alliance Button
   goto, AllianceLeave
   return
  }
return
 
AllianceLeave:
sleep, 4000
 
PixelGetColor, color, 350, 350, %AppVer% 
 If Color = 0x030839
  {
   ControlClick, x350 y350, %AppVer% ;Leave Alliance Tab
   goto, AllianceLeave
   return
  }
PixelGetColor, color, 380, 245, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x380 y245, %AppVer% ;Yes
   goto, AllianceLeave
   return
  }
PixelGetColor, color, 200, 245, %AppVer% 
 If Color = 0x474100
   {
   ControlClick, x200 y245, %AppVer% ;Ok Button
   goto, AllianceLeave
   return
  }
PixelGetColor, color, 200, 245, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x200 y245, %AppVer% ;Ok Button
   goto, AllianceLeave
   return
  }
sleep, 4000
goto, AllianceMenu
return
 
AllianceLeave2:
 
return
 
AllianceJoin:
sleep, 4000
PixelGetColor, color, 300, 490, %AppVer% 
 If Color = 0x030839
  {
   ControlClick, x300 y490, %AppVer% ;Close
   goto, AllianceJoin
   return
  }
PixelGetColor, color, 200, 160, %AppVer% 
 If Color = 0xFFFFFF
  {
   goto, AllianceInput
   return
  }
 
AllianceInput:
GuiControlGet, Alliance
   sleep, 3000
PixelSearch, Px, Py, 430, 160, 430, 160, 0x424447, 0, Fast
 If ErrorLevel = 0
  {
   goto, AllianceInput
   return
  }
PixelSearch, Px, Py, 417, 254, 417, 254, 0x151300, 5, Fast
 If ErrorLevel = 0
  {
   goto, AllianceInput
   return
  }
 
ControlClick, x200 y160, %AppVer% ;Find Field
sleep, 3000
SendRaw, %Alliance%
sleep, 3000
Send {enter}
sleep, 3000
 
PixelSearch, Px, Py, 430, 160, 430, 160, 0x424447, 0, Fast
 If ErrorLevel = 0
  {
   sleep, 3000
   goto, AllianceInput
   return
  }
PixelSearch, Px, Py, 395, 350, 390, 550, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   goto, AllianceInput
   return
  }
PixelSearch, Px, Py, 395, 350, 390, 550, 0x474100, 0, Fast
 If ErrorLevel != 0
  {
   goto, AllianceApply
   return
  }
return
 
AllianceApply:
sleep, 5000
 
PixelGetColor, color, 420, 255, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x420 y255, %AppVer%
   goto, AllianceApply
   return
  }
 
PixelGetColor, color, 300, 275, %AppVer% 
 If Color = 0x474100
  {
   ControlClick, x300 y275, %AppVer%
   goto, AllianceApply
   return
  }
 
PixelGetColor, color, 300, 330, %AppVer% 
 If Color = 0x030839
  {
   ControlClick, x300 y330, %AppVer%
   goto, AllianceApply
   return
  }
gosub, cityscreen
 
;Alliance Helps
PixelSearch, Px, Py, 445, 550, 445, 550, 0X282EA0, 10, Fast, %AppVer% ;Alliance Help
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 120000
   gosub, HelpIcon
   SetTimer, CityScreen, Off
   sleep, 3000
  }
     ;Alliance Helps
PixelSearch, Px, Py, 422, 544, 422, 548, 0X011CDD, 10, Fast, %AppVer% ;Alliance Help
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 120000
   gosub, HelpIcon
   SetTimer, CityScreen, Off
   sleep, 3000
  }
   SetTimer, SplashCheck, off
   varLogin = %vNext%
   goto, LogOff
return
 
PixelGetColor, color, 420, 325, %AppVer% 
 If Color = 0x424447
   {
    SetTimer, SplashCheck, off
    varLogin = %vNext%
 If varlogin = 56
     {
      GuiControl,,AccountMode,Done
     }
    goto, LogOff
   }
goto, AllianceApply
return
 
QuickHelps:
 
return
 
UpgradeStart:
toggleB := 1
BuildReturn = cyclesubs
goto, Build
return
 
Build:
If (BuildMe = 0)
 {
  toggleB := 0
  goto, %BuildReturn%
  return
 }
If (BuildMe = 1)
 {
;  toggleB := !toggle
  If (toggleB = 0)
   {
    SetTimer, BuildSearch, Off
    BeepCounter := 0
    BuildMe := 0
    goto, %BuildReturn%
    return
   }
  If (toggleB = 1)
   {
    gosub, AllTimersOff
    sleep, 2000
    gosub, BuildCheck
    gosub, MoveDown
    sleep, 1000
    SetTimer, BuildSearch, 5000
   }
 }
return
 
BuildCheck:
gosub, BuildHelpCheck
;Build Timer Bar in First Row
PixelSearch, Px, Py, 67, 132, 70, 135, 0x05064D, 10, Fast
 If ErrorLevel = 0
  {
   PixelSearch, Px, Py, 74, 142, 77, 145, 0x05064D, 10, Fast
    If ErrorLevel = 0
     {
      PixelSearch, Px, Py, 77, 130, 80, 133, 0x615F6B, 25, Fast
       If ErrorLevel = 0
        {
         BuildCount := 0
         SetTimer, BuildSearch, Off
         BeepCounter := 0
         BuildMe := 0
         goto, %BuildReturn%
         return
        }
     }
  }
 
;Build Timer Bar in Second Row
PixelSearch, Px, Py, 67, 164, 70, 167, 0x05064D, 10, Fast
 If ErrorLevel = 0
  {
   PixelSearch, Px, Py, 74, 172, 77, 175, 0x05064D, 10, Fast
    If ErrorLevel = 0
     {
      PixelSearch, Px, Py, 77, 163, 80, 166, 0x615F6B, 25, Fast
       If ErrorLevel = 0
        {
         BuildCount := 0
         SetTimer, BuildSearch, Off
         BeepCounter := 0
         BuildMe := 0
         goto, %BuildReturn%
         return
        }
     }
  }
return
 
BuildHelpCheck:
gosub, Randomwait
PixelSearch, Px, Py, 350, 130, 360, 130, 0x4D0A39, 2, Fast
 If ErrorLevel = 0
  {
   ControlClick, x350 y130, %AppVer% ;Free Button (Purple)
   sleep, 3000
   goto, BuildHelpCheck
  }
PixelSearch, Px, Py, 350, 130, 360, 130, 0x0F5CAB, 2, Fast
 If ErrorLevel = 0
  {
   ControlClick, x350 y130, %AppVer% ;Help Button (Gold)
   goto, BuildHelpCheck
  }
gosub, Randomwait
return
 
BuildSearch:
IfWinExist, %AppVer%
 WinActivate
gosub, sizecheck
gosub, BuildSplashCheck
gosub, BuildHelpCheck
;Build Timer Bar in First Row
PixelSearch, Px, Py, 67, 132, 70, 135, 0x05064D, 10, Fast
 If ErrorLevel = 0
  {
   PixelSearch, Px, Py, 74, 142, 77, 145, 0x05064D, 10, Fast
    If ErrorLevel = 0
     {
      PixelSearch, Px, Py, 77, 130, 80, 133, 0x615F6B, 25, Fast
       If ErrorLevel = 0
        {
         BuildCount := 0
         SetTimer, BuildSearch, Off
         BeepCounter := 0
         BuildMe := 0
         goto, %BuildReturn%
         return
        }
     }
  }
 
;Build Timer Bar in Second Row
PixelSearch, Px, Py, 67, 164, 70, 167, 0x05064D, 10, Fast
 If ErrorLevel = 0
  {
   PixelSearch, Px, Py, 74, 172, 77, 175, 0x05064D, 10, Fast
    If ErrorLevel = 0
     {
      PixelSearch, Px, Py, 77, 163, 80, 166, 0x615F6B, 25, Fast
       If ErrorLevel = 0
        {
         BuildCount := 0
         SetTimer, BuildSearch, Off
         BeepCounter := 0
         BuildMe := 0
         goto, %BuildReturn%
         return
        }
     }
  }
 
PixelSearch, Px, Py, 300, 555, 350, 555, 0x0F5CAB, 2, Fast ;SH Collect Button
 If ErrorLevel = 0
  {
   ControlClick, x300 y555, %AppVer%
   gosub, RandomWait
   return 
  }
 
PixelSearch, Px, Py, 350, 130, 360, 130, 0x424447, 2, Fast ;Free Button (Gray)
 If ErrorLevel = 0
  {
   gosub, RandomWait
   return
  }
 
PixelSearch, Px, Py, 350, 130, 360, 130, 0x170311, 2, Fast ;Free Button (Dark Gray Screen)
 If ErrorLevel = 0
  {
   gosub, RandomWait
   return
  }
 
PixelSearch, Px, Py, 350, 130, 360, 130, 0x4D0A39, 2, Fast
 If ErrorLevel = 0
  {
   ControlClick, x350 y130, %AppVer% ;Free Button (Purple)
   return
  }
 
 
PixelSearch, Px, Py, 85, 130, 360, 610, 0x0D7DD5, 0, Fast
 If ErrorLevel = 0
  {
   gosub, RandomWait
   Px -= 20
   ControlClick, x%Px% y%Py%, %AppVer% ;Upgrade Arrow
   gosub, RandomWait
   WallCheck = 1
   gosub, UpgradeWallCheck
  }
 
;Alliance Helps
PixelSearch, Px, Py, 445, 550, 445, 550, 0X282EA0, 10, Fast, %AppVer% ;Alliance Help
 If ErrorLevel = 0
  {
   SetTimer, CityScreen, 120000
   gosub, HelpIcon
   SetTimer, CityScreen, Off
   gosub, CityScreen
   SetTimer, InactivityX2, off
   return
  }
PixelSearch, Px, Py, 85, 125, 360, 610, 0x0D7DD5, 0, Fast
 If ErrorLevel = 0
  {
   gosub, RandomWait
   ControlClick, x%Px% y%Py%, %AppVer% ;Upgrade Arrow
   gosub, RandomWait
   goto, Upgrade1
  }
 
 else
 {
;Secret Chest
SetTimer, InactivityX2, off
PixelGetColor, color, 110, 511, %AppVer% ;Secret GIft
 SC1 = %color%
  gosub, RandomWait
PixelGetColor, color, 110, 511, %AppVer% ;Secret GIft
 SC2 = %color%
 If SC1 != %SC2%
  {
   SetTimer, CityScreen, 120000
   gosub, SecretChest
   SetTimer, CityScreen, Off
   SetTimer, InactivityX2, off
   return
  }
  BuildCount++
  gosub, MoveSelect
  return
 }
return
 
BuildSplashCheck:
PixelSearch, Px, Py, 80, 73, 80, 73, 0xFFFFFF, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x80 y73, %AppVer% ;Facebook Close
   gosub, RandomWait
   ControlClick, x80 y73, %AppVer% ;Facebook Close
   return
  }
PixelSearch, Px, Py, 411, 77, 411, 77, 0xDCDCDC, 10, Fast ;GoW Facebook Close
 If ErrorLevel = 0
  {
   gosub, RandomWait
   ControlClick, x411 y77, %AppVer%
   gosub, MoveLeftSlightly
   return
  }
 
PixelSearch, Px, Py, 430, 170, 430, 170, 0x4D0A39, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y170, %AppVer% ;Collect Button
   return
  }
 
PixelSearch, Px, Py, 350, 130, 360, 130, 0x0F5CAB, 2, Fast
 If ErrorLevel = 0
  {
   ControlClick, x350 y130, %AppVer% ;Help Button (Gold)
   gosub, RandomWait
   BuildCount := 0
   SetTimer, BuildSearch, Off
   BeepCounter := 0
   BuildMe := 0
   goto, %BuildReturn%
   return
  }
 
PixelSearch, Px, Py, 300, 425, 300, 425, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x300 y425, %AppVer% ;Collect Button
   return
  }
 
PixelSearch, Px, Py, 300, 400, 300, 400, 0x0F5CAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x300 y400, %AppVer% ;Collect Button
   gosub, RandomWait
   gosub, MoveLeftSlightly
   return
  }
return
 
UpgradeWallCheck:
sleep, 3000
gosub, BuildSplashCheck
If (WallCheck = 1)
 {
  gosub, WallCheck2
  return
 }
If (WallCheck = 2)
 {
  gosub, WallCheck2
  return
 }
If (WallCheck = 3)
 {
  gosub, WallCheck2
  return
 }
If (WallCheck = 4)
 {
  BuildCount++
  WallCheck := 0
  return
 }
return
 
WallCheck2:
gosub, BuildSplashCheck
PixelSearch, Px, Py, 425, 170, 425, 170, 0x474100, 0, Fast
   If ErrorLevel != 0
    {
     WallCheck++
     sleep, 3000
     Px += 10
     ControlClick, x%Px% y%Py%, %AppVer% ;Upgrade Arrow
     gosub, BuildSplashCheck
     sleep, 3000
    }
PixelSearch, Px, Py, 425, 170, 425, 170, 0x474100, 0, Fast
If ErrorLevel = 0
 {
  sleep, 3000
  WallCheck = 0
  goto, Upgrade1
 }
return
 
Upgrade1:
sleep, 3000
IfWinExist, %AppVer%
 WinActivate
gosub, BuildSplashCheck
PixelSearch, Px, Py, 85, 125, 360, 610, 0x0D7DD5, 0, Fast
 If ErrorLevel = 0
  {
   sleep, 3000
   Px -= 20
   ControlClick, x%Px% y%Py%, %AppVer% ;Upgrade Arrow
   sleep, 3000
   goto, Upgrade1
  }
PixelSearch, Px, Py, 430, 170, 430, 170, 0x4D0A39, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y170, %AppVer% ;Collect Button
   return
  }
PixelSearch, Px, Py, 425, 170, 425, 170, 0x474100, 0, Fast
If ErrorLevel = 0
 {
  ControlClick, x425 y170, %AppVer% ;Upgrade
  sleep, 3000
  goto, Upgrade2
  return
 }
 
PixelSearch, Px, Py, 85, 125, 360, 610, 0x0D7DD5, 0, Fast
 If ErrorLevel = 0
  {
   sleep, 3000
   Px -= 20
   ControlClick, x%Px% y%Py%, %AppVer% ;Upgrade Arrow
   sleep, 3000
   goto, Upgrade1
  }
 
If (checkboxSH = 1)
 {
    PixelSearch, Px, Py, 280, 170, 280, 170, 0x030839, 0, Fast
     If ErrorLevel = 0
      {
       PixelSearch, Px, Py, 425, 170, 425, 170, 0x474100, 0, Fast
        If ErrorLevel = 0
         {
          ControlClick, x425 y170, %AppVer% ;Upgrade
          sleep, 3000
          goto, Upgrade2
         }
     Else
      {
       goto, Upgrade2
       return
      }
   }
}
return
 
 
Upgrade2:
sleep, 3000
PixelSearch, Px, Py, 430, 170, 430, 170, 0x4D0A39, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y170, %AppVer% ;Collect Button
   return
  }
       PixelSearch, Px, Py, 425, 170, 425, 170, 0x474100, 0, Fast
        If ErrorLevel = 0
         {
          sleep, 3000
          PixelSearch, Px, Py, 290, 170, 290, 170, 0x002C00, 0, Fast
           If ErrorLevel = 0
            {
             PixelSearch, Px, Py, 425, 170, 425, 170, 0x474100, 0, Fast
              If ErrorLevel = 0
               {
                ControlClick, x425 y170, %AppVer% ;Upgrade
                return
               }
            }
          }
goto, CityScreen
return
 
MoveSelect:
         gosub, CityScreen
PixelSearch, Px, Py, 350, 130, 350, 130, 0x4D0A39, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x350 y130, %AppVer% ;Free Button
   sleep, 3000
   goto, MoveSelect
  }
PixelSearch, Px, Py, 350, 130, 350, 130, 0x05FCAB, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x350 y130, %AppVer% ;Help Button
   sleep, 3000
   BuildCount = 22
  }
 
If (BuildCount = 0)
  {
   return
  }
If (BuildCount = 1)
  {
;   goto, MoveDown
   return
  }
If (BuildCount = 2)
  {
   goto, MoveDown
  }
If (BuildCount = 3)
  {
   goto, MoveRight
  }
If (BuildCount = 4)
  {
   goto, MoveRight
  }
If (BuildCount = 5)
  {
   goto, MoveRight
  }
If (BuildCount = 6)
  {
   goto, MoveRight
  }
If (BuildCount = 7)
  {
   goto, MoveRight
  }
If (BuildCount = 8)
  {
   goto, MoveRight
  }
If (BuildCount = 9)
  {
   goto, MoveRight
  }
If (BuildCount = 10)
  {
   goto, MoveRight
  }
 
If (BuildCount = 11)
  {
   goto, MoveUp
  }
If (BuildCount = 12)
  {
   goto, MoveUp
  }
If (BuildCount = 13)
  {
   goto, MoveLeft
  }
If (BuildCount = 14)
  {
   goto, MoveLeft
  }
If (BuildCount = 15)
  {
   goto, MoveLeft
  }
If (BuildCount = 16)
  {
   goto, MoveLeft
  }
If (BuildCount = 17)
  {
   goto, MoveLeft
  }
If (BuildCount = 18)
  {
   goto, MoveLeft
  }
If (BuildCount = 19)
  {
   goto, MoveLeft
  }
If (BuildCount = 20)
  {
   goto, MoveLeft
  }
If (BuildCount = 21)
  {
   goto, MoveLeft
  }
 
If (BuildCount = 22)
  {
   BuildCount := 0
   SetTimer, BuildSearch, Off
   BeepCounter := 0
   BuildMe := 0
   goto, %BuildReturn%
  }
return
 
MoveRight:
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 370, 370, down}
gosub, RandomWait
SendEvent {click 250, 370, up}
gosub, RandomWait
;goto, Build
return
 
MoveDown:
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 370, 470, down}
gosub, RandomWait
SendEvent {click 370, 225, up}
gosub, RandomWait
 
return
 
MoveLeft:
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 65, 370, down}
gosub, RandomWait
SendEvent {click 250, 370, up}
gosub, RandomWait
;goto, Build
return
 
MoveUp:
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 370, 225, down}
gosub, RandomWait
SendEvent {click 370, 470, up}
gosub, RandomWait
return
 
MoveRightSlightly:
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 370, 325, down}
gosub, RandomWait
SendEvent {click 370, 225, up}
gosub, RandomWait
;goto, Build
return
 
MoveLeftSlightly:
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 300, 225, down}
gosub, RandomWait
SendEvent {click 370, 225, up}
gosub, RandomWait
;goto, Build
return
 
Shield:
IfWinExist, %AppVer%
    WinActivate
gosub, RandomWait
PixelSearch, Px, Py, 425, 240, 425, 240, 0xC3D9E0, 25, Fast
 If ErrorLevel != 0
  {
   gosub, ItemsWait
   gosub, MyItemsMenu
   gosub, WarItemsWait
   gosub, ShieldAvailableCheck
   gosub, CityScreen
   sleep, 3000
   BeepCounter := 0
   ShieldMe := 0
   goto, cyclesubs
   toggleA := 0
  }
PixelSearch, Px, Py, 425, 240, 425, 240, 0xC3D9E0, 25, Fast
 If ErrorLevel = 0
  {
   gosub, CityScreen
   sleep, 3000
   toggleA := 0
   BeepCounter := 0
   ShieldMe := 0
   goto, cyclesubs
  }
return
 
ShieldAvailableCheck:
PixelSearch, Px, Py, 130, 350, 130, 350, 0xAB491B, 25, Fast
 If ErrorLevel = 0
  {
   ControlClick, x375 y375, %AppVer% ;select Peace Shield Icon
   gosub, RandomWait
   return
  }
PixelSearch, Px, Py, 130, 350, 130, 350, 0xAB491B, 25, Fast
 If ErrorLevel != 0
  {
   goto, BuyShieldWait
  }
return
 
AllianceBuyShieldWait:
gosub, CityScreen
sleep, 3000
gosub, AllianceMenu
gosub, AllianceStore1
gosub, AllianceStore2
msgbox, select the shield.
return
 
BuyShieldWait:
   gosub, ItemsWait
   gosub, StoreWait
   gosub, WarItemsWait
   gosub, ShieldAvailableCheck
   PixelSearch, Px, Py, 370, 360, 370, 360, 0x002C00, 0, Fast
 If ErrorLevel != 0
  {
   goto, BuyShieldWait
  }
   PixelSearch, Px, Py, 370, 360, 370, 360, 0x002C00, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x375 y375, %AppVer% ;select Buy Peace Shield
   sleep, 3000
   PixelSearch, Px, Py, 225, 280, 225, 280, 0x030839, 3, Fast
    If ErrorLevel = 0
     {
      ControlClick, x225 y280, %AppVer%
      gosub, CityScreen
      sleep, 3000
      MsgBox, Shield Not Available for %login%.
      sleep, 3000
      BeepCounter := 0
      ShieldMe := 0
      goto, cyclesubs
      toggleA := 0
      return
     }
   }
goto, Shield
return
 
AllianceStore1:
   gosub, RandomWait
PixelSearch, Px, Py, 325, 525, 325, 525, 0x474100, 3, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 325, 525, 325, 525, 0x474100, 3, Fast
 If ErrorLevel != 0
  {
   ControlClick, x325 y525, %AppVer% ;select Treasures
   gosub, RandomWait
   goto, AllianceStore1
  }
return
 
AllianceStore2:
   gosub, RandomWait
PixelSearch, Px, Py, 70, 160, 450, 600, 0x040E43, 3, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 70, 160, 450, 600, 0x040E43, 3, Fast
 If ErrorLevel != 0
  {
   ControlClick, x325 y525, %AppVer% ;select Store Tab
   gosub, RandomWait
   goto, AllianceStore2
  }
return
 
QueAllTroops:
   sleep, 3000
PixelSearch, Px, Py, 175, 575, 175, 575, 0x474100, 3, Fast
 If ErrorLevel = 0
  {
   ControlClick, x175 y575, %AppVer%
   sleep, 2000
   goto, HealTroops
  }
PixelSearch, Px, Py, 175, 575, 175, 575, 0x474100, 3, Fast
 If ErrorLevel != 0
  {
   gosub, CityScreen
   sleep, 3000
  }
return
 
HealTroops:
PixelSearch, Px, Py, 425, 580, 425, 580, 0x474100, 3, Fast
 If ErrorLevel = 0
  {
   ControlClick, x425 y580, %AppVer%
   sleep, 2000
   goto, HealTroops
  }
PixelSearch, Px, Py, 425, 580, 425, 580, 0x474100, 3, Fast
 If ErrorLevel != 0
  {
   gosub, CityScreen
   sleep, 3000
  }
return
 
;------Donate------
 
DonateFinished:
StoneDonated := 0
WoodDonated := 0
OreDonated := 0
FoodDonated := 0
SilverDonated := 0
DonateMe := 0
RSSCounter := 0
Traidwait := 0
MarchSlots := 0
BeepCounter := 0
gosub, CityScreen
GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
GuiControl,1:,AccountMode,Searching
return
 
DonateRSS:
IfWinExist, %AppVer%
    WinActivate
GuiControlGet,RSSTotal,4:
GuiControlGet,RSSStone,4:
GuiControlGet,RSSWood,4:
GuiControlGet,RSSOre,4:
GuiControlGet,RSSfood,4:
GuiControlGet,RSSSilver,4:
RSSTotal := RSSStone + RSSWood + RSSOre + RSSFood + RSSSilver
RSSCounter := StoneDonated + WoodDonated + OreDonated + FoodDonated + SilverDonated
If (RSSCounter = RSSTotal)
  {
   goto, DonateFinished
  }
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
sleep, 1000
GuiControl,1:,AccountMode,Donating
GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
Gui 4:Submit, NoHide
Gosub, mapscreen
gosub, RandomWait
Gosub, CenterCity
gosub, RandomWait
gosub, SelectCenterCity
gosub, DonateButton
gosub, DonateScreen
goto, AddRSS
return
 
PlayerCityDonate:
 
If (RSSCounter = RSSTotal)
  {
   goto, DonateFinished
  }
gosub, SelectCenterCity
gosub, DonateButton
gosub, DonateScreen
goto, AddRSS
return
 
CenterCity:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
GuiControlGet, DonateAC, 4:
GuiControlGet, Xcoord, 4:
GuiControlGet, Ycoord, 4:
 
If (DonateAC = 1)
 {
  ControlClick, x325 y50, %AppVer% ;select Alliance City
  sleep, 5000
  return
 }
 
If (DonateAC = 0)
 {
  ControlClick, x184 y47, %AppVer% ;select Map Search Menu Icon
  PixelGetColor, color, 225, 320, %AppVer% ;Red Cancel Button
   If Color != 0x030839
    {
     gosub, RandomWait
     goto, CenterCity
    }
  PixelGetColor, color, 225, 320, %AppVer% ;Red Cancel Button
   If Color = 0x030839
    {
     ControlClick, x80 y80, %AppVer% ;Upper Right Corner of Page
      sleep, 1000
     PixelSearch, Px, Py, 250, 230, 290, 230, 0x09142D, 50, Fast
     If ErrorLevel != 0
      {
       gosub, SendXcoord
      }
     PixelSearch, Px, Py, 340, 230, 390, 230, 0x09142D, 50, Fast
      If ErrorLevel != 0
      {
       gosub, SendYcoord
      }
     gosub, GotoCoords
      }
    }
return 
 
SendXcoord:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
sleep, 2000
PixelSearch, Px, Py, 250, 230, 290, 230, 0x09142D, 50, Fast
 If ErrorLevel != 0
  {
   ControlClick, x266 y233, %AppVer% ;MZ Account Email field
   sleep, 1000
   SendRaw, %Xcoord%
   sleep, 1000
   ControlClick, x80 y80, %AppVer% ;Upper Right Corner of Page
   goto, SendXcoord
  }
return
 
SendYcoord:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
sleep, 2000
PixelSearch, Px, Py, 340, 230, 390, 230, 0x09142D, 50, Fast
 If ErrorLevel != 0
  {
   ControlClick, x362 y233, %AppVer% ;Password field
   sleep, 1000
   SendRaw, %Ycoord%
   sleep, 1000
   ControlClick, x80 y80, %AppVer% ;Upper Right Corner of Login Page
   goto, SendYcoord
  }
return
 
GotoCoords:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
sleep, 2000
PixelGetColor, color, 225, 320, %AppVer% ;Red Cancel Button
 If Color = 0x030839
  {
   ControlClick, x300 y315, %AppVer% ;Goto Button
   goto, GotoCoords
  }
return
 
SelectCenterCity:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
GuiControlGet, DonateAC, 4:
sleep, 5000
 
PixelSearch, Px, Py, 170 ,240, 170 ,240, 0x474100, 0, Fast, %AppVer% ;Max Limit Notice (Teal)
 If ErrorLevel = 0
  {
   gosub, MaxMarchLimitWait
   goto, SelectCenterCity
  }
 
  PixelSearch, Px, Py, 400, 340, 400, 340, 0x474100, 0, Fast, %AppVer%
   If ErrorLevel != 0
    {
     ControlClick, x240 y400, %AppVer% ;select city in center of screen
     goto, SelectCenterCity
    }
If (DonateAC = 0)
 {
  PixelSearch, Px, Py, 260, 340, 260, 340, 0x474100, 0, Fast, %AppVer% ;Player City Not Selected
   If ErrorLevel != 0
    {
     ControlClick, x415 y155, %AppVer% ;Close city
     goto, CenterCity
    }
  }
If (DonateAC = 1)
 {
  PixelSearch, Px, Py, 260, 380, 260, 380, 0x474100, 0, Fast, %AppVer% ;Alliance City Not Selected
   If ErrorLevel != 0
    {
     ControlClick, x415 y155, %AppVer% ;Close city
     goto, CenterCity
    }
 }
return
 
DonateButton:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
sleep, 5000
PixelSearch, Px, Py, 400, 560, 400, 560, 0x424447, 0, Fast, %AppVer%
 If ErrorLevel != 0
  {
   PixelSearch, Px, Py, 400, 340, 400, 340, 0x474100, 0, Fast, %AppVer%
    If ErrorLevel = 0
     {
      ControlClick, x400 y350, %AppVer% ;select city in center of screen
      goto, DonateButton
     }
  }
return
 
DonateScreen:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
sleep, 5000
PixelSearch, Px, Py, 170 ,240, 170 ,240, 0x474100, 0, Fast, %AppVer% ;Max Limit Notice (Teal)
 If ErrorLevel = 0
  {
   gosub, MaxMarchLimitWait
   goto, DonateScreen
  }
PixelSearch, Px, Py, 420, 165, 420, 165, 0xFFFFFF, 0, Fast, %AppVer%
 If ErrorLevel != 0
  {
   PixelSearch, Px, Py, 400, 350, 400, 350, 0x474100, 0, Fast, %AppVer%
    If ErrorLevel != 0
     {
      ControlClick, x400 y350, %AppVer%
      goto, DonateScreen
     }
  }
return
 
AddRSS:
GuiControlGet,RSSTotal,4:
GuiControlGet,RSSStone,4:
GuiControlGet,RSSWood,4:
GuiControlGet,RSSOre,4:
GuiControlGet,RSSfood,4:
GuiControlGet,RSSSilver,4:
RSSTotal := RSSStone + RSSWood + RSSOre + RSSFood + RSSSilver
RSSCounter := StoneDonated + WoodDonated + OreDonated + FoodDonated + SilverDonated
If (RSSCounter = RSSTotal)
  {
   goto, DonateFinished
  }
GuiControlGet, DonateAC, 4:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
If (RSSTotal = 0)
 {
  goto, DonateFinished
 }
If (StoneDonated < RSSStone)
 {
  Ry1 = 160
  Rx1 = 350
  StoneDonated++
  goto, AddRSS2
 }
If (WoodDonated < RSSWood)
 {
  Ry1 = 210
  Rx1 = 350
  WoodDonated++
  goto, AddRSS2
 }
If (OreDonated < RSSOre)
 {
  Ry1 = 260
  Rx1 = 350
  OreDonated++
  goto, AddRSS2
 }
If (FoodDonated < RSSFood)
 {
  Ry1 = 310
  Rx1 = 285
  DonateFood++
  goto, AddRSS2
 }
If (SilverDonated < RSSSilver)
 {
  Ry1 = 310
  Rx1 = 285
  SilverDonated++
  goto, AddRSS2
 }
 
 
goto, DonateFinished
return
 
AddRSS2:
PixelSearch, Px, Py, 400,555, 400,555, 0x424447, 0, Fast, %AppVer% ;Donate Button (Gray)
 If ErrorLevel = 0
  {
   gosub, AddRSSTotal
   goto, TradeConfirm
  }
PixelSearch, Px, Py, 400, 555, 400, 555, 0x474100, 0, Fast, %AppVer% ;Donate Button (Teal)
 If ErrorLevel = 0
  {
   ControlClick, x400 y550, %AppVer% ;Donate Button (Teal)
   gosub, RandomWait
   goto, TradeConfirm
  }
return
 
AddRSSTotal:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
SetDefaultMouseSpeed, 10
SendEvent {Click 130, %Ry1%, down}
gosub, RandomWait
SendEvent {Click %Rx1%, %Ry1%, up}
return
 
SubtractRSS:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
gosub, RandomWait
SetDefaultMouseSpeed, 10
SendEvent {Click 300, %Ry1%, down}
gosub, RandomWait
SendEvent {Click 77, %Ry1%, up}
return
 
TradeConfirm:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
GuiControlGet, DonateAC, 4:
sleep, 3000
PixelSearch, Px, Py, 400, 560, 400, 560, 0x474100, 0, Fast, %AppVer% ;Donate Button (Teal)
 If ErrorLevel = 0
  {
   ControlClick, x400 y560, %AppVer% ;Donate Button (Teal)
   goto, TradeConfirm
  }
 
PixelSearch, Px, Py, 170 ,240, 170 ,240, 0x474100, 0, Fast, %AppVer% ;Max Limit Notice (Teal)
 If ErrorLevel = 0
  {
   gosub, MaxMarchLimitWait
   goto, TradeConfirm
  }
 
PixelSearch, Px, Py, 170 ,270, 170 ,270, 0x474100, 0, Fast, %AppVer% ;Insufficient RSS Notice (Teal)
 If ErrorLevel = 0
  {
   ControlClick, x170 y270, %AppVer% ;Yes Button (Teal)
   gosub, SubtractRSS
   goto, TradeConfirm
  }
 
PixelSearch, Px, Py, 400,250, 400,250, 0x474100, 0, Fast, %AppVer% ;Yes Button (Teal)
 If ErrorLevel = 0
  {
   ControlClick, x400 y250, %AppVer% ;Yes Button (Teal)
   goto, TradeConfirm
  }
 
PixelSearch, Px, Py, 400,555, 400,555, 0x424447, 0, Fast, %AppVer% ;Donate Button (Gray)
 If ErrorLevel = 0
  {
   TraidWait := 0
   gosub, RandomWait
    If (DonateAC = 1)
     {
      GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
      RSSCounter++
      goto, AddRSS
     }
    If (DonateAC = 0)
     {
      GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
      RSSCounter++
      goto, PlayerCityDonate
     }
  }
TraidWait := 0
gosub, RandomWait
If (DonateAC = 1)
 {
  GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
  RSSCounter++
  goto, AddRSS
 }
If (DonateAC = 0)
 {
  GuiControl,4:,DonationNumbers,( %RSSCounter% of  %RSSTotal% )
  RSSCounter++
  goto, PlayerCityDonate
 }
return
 
MaxMarchLimitWait:
If (DonateNow = 0)
 {
  goto, DonateFinished
 }
ControlClick, x170 y240, %AppVer% ;Yes Button (Teal)
sleep, 10000
PixelSearch, Px, Py, 170 ,240, 170 ,240, 0x474100, 0, Fast, %AppVer% ;Max Limit Notice (Teal)
 If ErrorLevel = 0
  {
   TraidWait++
   If (TraidWait <=6)
    {
     PixelSearch, Px, Py, 170 ,240, 170 ,240, 0x474100, 0, Fast, %AppVer% ;Max Limit Notice (Teal)
      If ErrorLevel = 0
       {
        goto, MaxMarchLimitWait
       }
    }
   If (TraidWait > 6)
    {
     PixelSearch, Px, Py, 170 ,240, 170 ,240, 0x474100, 0, Fast, %AppVer% ;Max Limit Notice (Teal)
      If ErrorLevel = 0
       {
        ControlClick, x170 y240, %AppVer% ;Yes Button (Teal)
        sleep, 1000
        goto, DonateFinished
       }
     }
  }
return
 
;----------Train Troops----------
 
PickTroop:
 
Gui, Submit, nohide
If (TroopType = 1)
 {
  TroopPage := 1
  TroopLocation = x125 y350
 }
If (TroopType = 2)
 {
  TroopPage := 1
  TroopLocation = x250 y350
 }
If (TroopType = 3)
 {
  TroopPage := 1
  TroopRow := 1
  TroopLocation = x400 y350
 }
If (TroopType = 4)
 {
  TroopPage := 1
  TroopRow := 2
  TroopLocation = x125 y350
 }
If (TroopType = 5)
 {
  TroopPage := 1
  TroopRow := 2
  TroopLocation = x250 y350
 }
If (TroopType = 6)
 {
  TroopPage := 1
  TroopRow := 2
  TroopLocation = x400 y350
 }
If (TroopType = 7)
 {
  TroopPage := 1
  TroopRow := 3
  TroopLocation = x125 y350
 }
If (TroopType = 8)
 {
  TroopPage := 1
  TroopRow := 3
  TroopLocation = x250 y350
 }
If (TroopType = 9)
 {
  TroopPage := 1
  TroopRow := 3
  TroopLocation = x400 y350
 }
If (TroopType = 10)
 {
  TroopPage := 1
  TroopRow := 4
  TroopLocation = x125 y350
 }
If (TroopType = 11)
 {
  TroopPage := 1
  TroopRow := 4
  TroopLocation = x250 y350
 }
If (TroopType = 12)
 {
  TroopPage := 1
  TroopRow := 4
  TroopLocation = x400 y350
 }
If (TroopType = 13)
 {
  TroopPage := 1
  TroopRow := 5
  TroopLocation = x125 y350
 }
If (TroopType = 14)
 {
  TroopPage := 1
  TroopRow := 5
  TroopLocation = x250 y350
 }
If (TroopType = 15)
 {
  TroopPage := 1
  TroopRow := 5
  TroopLocation = x400 y350
 }
If (TroopType = 16)
 {
  TroopPage := 1
  TroopRow := 6
  TroopLocation = x125 y350
 }
If (TroopType = 17)
 {
  TroopPage := 2
  TroopLocation = x125 y350
 }
If (TroopType = 18)
 {
  TroopPage := 2
  TroopLocation = x250 y350
 }
If (TroopType = 19)
 {
  TroopPage := 2
  TroopRow := 1
  TroopLocation = x400 y350
 }
If (TroopType = 20)
 {
  TroopPage := 2
  TroopRow := 2
  TroopLocation = x125 y350
 }
If (TroopType = 21)
 {
  TroopPage := 2
  TroopRow := 2
  TroopLocation = x250 y350
 }
If (TroopType = 22)
 {
  TroopPage := 2
  TroopRow := 2
  TroopLocation = x400 y350
 }
If (TroopType = 23)
 {
  TroopPage := 2
  TroopRow := 3
  TroopLocation = x125 y350
 }
If (TroopType = 24)
 {
  TroopPage := 2
  TroopRow := 3
  TroopLocation = x250 y350
 }
If (TroopType = 25)
 {
  TroopPage := 2
  TroopRow := 3
  TroopLocation = x400 y350
 }
If (TroopType = 26)
 {
  TroopPage := 2
  TroopRow := 4
  TroopLocation = x125 y350
 }
If (TroopType = 27)
 {
  TroopPage := 2
  TroopRow := 4
  TroopLocation = x250 y350
 }
If (TroopType = 28)
 {
  TroopPage := 2
  TroopRow := 4
  TroopLocation = x400 y350
 }
return
 
StartTraining:
 
 If(toggleTrain = 1)
  {
   toggleTrain := 0
   SetTimer, TrainingCheck, off
   goto, cityscreen
  }
 If(toggleTrain = 0)
  {
   toggleTrain := 1
   Gui 5:Submit, NoHide
   SetTimer, TrainingCheck, 10000
   goto, TrainingCheck
  return
  }
 
return
 
TrainToggle:
 If(toggleTrain = 1)
  {
   toggleTrain := 0
   SetTimer, TrainingCheck, off
   goto, cityscreen
  }
 If(toggleTrain = 0)
  {
   toggleTrain := 1
   goto, Train
  return
  }
 
Train:
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   goto, cityscreen
  }
GuiControl,,AccountMode,Training
SetTimer, TrainingCheck, off
IfWinExist, %AppVer%
 {
  WinActivate
  sleep, 1000
  gosub, Resize
  sleep, 1000
  gosub, CityScreen
  sleep, 1000
  gosub, MoreMenu
  sleep, 1000
  gosub, TrainMenu
  sleep, 1000
  gosub, SelectTroops
  sleep, 1000
  gosub, TrainTroops
  sleep, 1000
  gosub, CityScreen
  toggleTrain := 0
  sleep, 1000
  return
  }
 Else
  {
   MsgBox, Emulator not detected.
  }
Return
 
TrainMenu:
IfWinExist,  %AppVer%
 WinActivate
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   return
  }
sleep, 2000
PixelSearch, Px, Py, 420, 170, 420, 170, 0x474100, 0, Fast ;Upgrade Button on "Barracks" screen
 If ErrorLevel != 0
  {
   ControlClick, x215 y400,  %AppVer% ;Train Menu Icon location in More Menu
   sleep, 1000
   goto, TrainMenu
   return
  }
return
 
SelectTroops:
IfWinExist,  %AppVer%
 WinActivate
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   return
  }
If (TroopPage = 2)
 {
  gosub, TroopPage2
 }
If (TroopRow = 2)
 {
  gosub, TroopRowUp
 }
If (TroopRow = 3)
 {
  gosub, TroopRowUp
  gosub, TroopRowUp
 }
If (TroopRow = 4)
 {
  gosub, TroopRowUp
  gosub, TroopRowUp
  gosub, TroopRowUp
 }
If (TroopRow = 5)
 {
  gosub, TroopRowUp
  gosub, TroopRowUp
  gosub, TroopRowUp
  gosub, TroopRowUp
 }
If (TroopRow = 6)
 {
  gosub, TroopRowUp
  gosub, TroopRowUp
  gosub, TroopRowUp
  gosub, TroopRowUp
  gosub, TroopRowUp
 }
 
sleep, 2000
PixelSearch, Px, Py, 400, 700, 400, 700, 0x474100, 0, Fast ;Train Button on "Barracks" screen
 If ErrorLevel != 0
  {
   ControlClick, %TroopLocation%,  %AppVer%
   sleep, 3000
   goto, TrainTroops
   return
  }
goto, TrainMenu
return
 
TroopPage2:
IfWinExist,  %AppVer%
 WinActivate
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   return
  }
sleep, 2000
PixelSearch, Px, Py, 300, 235, 300, 235, 0x586773, 10, Fast ;Grayed out Strategic Troops tab
 If ErrorLevel = 0
  {
   ControlClick, x300 y235,  %AppVer%
   goto, TroopPage2
  }
return
 
TroopRowUp:
IfWinExist,  %AppVer%
 WinActivate
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   return
  }
SetDefaultMouseSpeed, 10
SendEvent {Click 330, 555, down}
sleep, 2000
SendEvent {click 370, 440, up}
sleep, 2000
return
 
TrainTroops:
IfWinExist,  %AppVer%
 WinActivate
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   return
  }
sleep, 2000
 
PixelSearch, Px, Py, 247, 678, 247, 678, 0x474100, 0, Fast ;Teal Go to the Academy Button
 If ErrorLevel = 0
  {
   ControlClick, x80 y100,  %AppVer% ;Blank space in upper right hand corner of window
   return
  }
 
PixelSearch, Px, Py, 230, 390, 230, 390, 0x030839, 0, Fast ;Red No Button popup when already training
 If ErrorLevel = 0
  {
   ControlClick, x230 y390,  %AppVer%
   goto, AlreadyTraining
  }
 
PixelSearch, Px, Py, 430, 220, 430, 220, 0x474100, 0, Fast ;Small Speedup Button on "Barracks" screen when training
 If ErrorLevel != 0
  {
   ControlClick, x400 y700,  %AppVer% ;Train Button on "Barracks" screen
   goto, TrainTroops
  }
return
 
AlreadyTraining:
IfWinExist,  %AppVer%
 WinActivate
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   goto, cityscreen
  }
sleep, 2000
PixelSearch, Px, Py, 230, 390, 230, 390, 0x030839, 0, Fast ;Red No Button popup when already training
 If ErrorLevel = 0
  {
   ControlClick, x230 y390,  %AppVer%
   sleep, 2000
   ControlClick, x80 y100,  %AppVer% ;Blank space in upper right hand corner of window
   goto, AlreadyTraining
  }
Return
 
TrainingCheck:
IfWinExist,  %AppVer%
 WinActivate
 If(toggleTrain = 0)
  {
   SetTimer, TrainingCheck, off
   goto, cityscreen
  }
 
PixelSearch, Px, Py, 75, 130, 75, 130, 0x33647E, 3, Fast ;Troop Training Icon Row 1 (Part 1)
 If ErrorLevel != 0
  {
   PixelSearch, Px, Py, 75, 135, 75, 135, 0x9FB8B5, 3, Fast ;Troop Training Icon Row 1 (Part 2)
    If ErrorLevel != 0
     {
      PixelSearch, Px, Py, 75, 162, 75, 162, 0x32546D, 3, Fast ;Troop Training Icon Row 2 (Part 1)
       If ErrorLevel != 0
        {
         PixelSearch, Px, Py, 75, 167, 75, 167, 0x9FAFAC, 3, Fast ;Troop Training Icon Row 2 (Part 2)
          If ErrorLevel != 0
           {
            goto, Train
           }
        }
     }
  }
return
 
;----------Misc Working----------
 
Test:
msgbox, Nothing Testing
return
 
;GoW Automation End Part 3 of 3


speedy
  • Members
  • 1 posts
  • Last active: Nov 10 2015 10:47 PM
  • Joined: 06 Nov 2015

I'd like to contribute to this I think it's wonderful, but I'm new to ahk and need a little more guidance.  Also, where are you as far as getting this running?



Greystoke
  • Members
  • 1 posts
  • Last active: Nov 29 2015 12:50 AM
  • Joined: 05 Nov 2015

Have you any update on getting the script working



goof_troop
  • Members
  • 3 posts
  • Last active: Dec 22 2015 04:13 PM
  • Joined: 11 Dec 2015
This says you took features out, but i still see the code gor training, and upgrades. Do these still work?