Jump to content

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

Mobile Game - Game of War Automation script Part 1 of 3


  • Please log in to reply
20 replies to this topic
Malechite
  • Members
  • 23 posts
  • Last active: Sep 04 2016 08:02 PM
  • Joined: 30 Jul 2015

;GoW Automation Part 1 of 3

If not A_IsAdmin
{
DLLCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath, str, """" .A_ScriptFullPath . """", str, A_WorkingDir, int, 1)
ExitApp
}

; For use with Droid4X 0.8.0-3, and supports WIN 7-10
; This script is an automation script and GUI interface for most general
; Game of War functions, but the concept could easily be applied to any number of "mobile games"
; it operates numerous accounts (60 to count), and is capable of performing the following game
; functions:
; Logon/Logoff, Alliance Help, Quest completion/collection, Secret chest/Athena chest
; collection, Alliance Gift collection, Dungeon operations, Building Upgrade, Troop healing,
; account Alliance Leave/Join function, Alliance City / Player City Donations with "trip count"
; for each resource type, Automated Chest opening feature, Auto-combining feature.

; This script has been compiled and adjusted from many autohotkey members code snippits,
; and is provided as a Beta version only, and can be limited by your internet connection
; speeds, but is stable.
; Please let me know if you notice any major changes that can be applied to improve it.

#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 200
Gui 1:+AlwaysOnTop

;Username and Password Variables

Login1 = name@gmail.com
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 = name+01@gmail.com
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 = x110 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 := false
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
RSSTotal := RSSStone + RSSWood + RSSOre + RSSFood + RSSSilver

GR1 = y110 ; %GR1%
GR2 = y135 ; %GR2%
GR3 = y175 ; %GR3%
GR4 = y200 ; %GR4%
GC1 = x10 ; %GC1%
GC2 = x40 ; %GC2%
GC3 = x220 ; %GC3%
GC4 = x250 ; %GC4%
GC5 = x430 ; %GC5%
GC6 = x460 ; %GC6%
G2R0 = y10 ; %GR0%

G2R1L = y30 ;
G2R1C1 = y38
G2R1C2 = y60
G2R1L2 = y53
G2R1 = y50 ;

G2R2L = y80 ;
G2R2C1 = y88
G2R2C2 = y110
G2R2L2 = y103
G2R2 = y100 ;

G2R3L = y130 ;
G2R3C1 = y138
G2R3C2 = y160
G2R3L2 = y153
G2R3 = y150 ;

G2R4L = y180 ;
G2R4C1 = y188
G2R4C2 = y210
G2R4L2 = y203
G2R4 = y200 ;

G2R5L = y230 ;
G2R5C1 = y238
G2R5C2 = y260
G2R5L2 = y253
G2R5 = y250 ;

G2R6L = y280 ;
G2R6C1 = y288
G2R6C2 = y310
G2R6L2 = y303
G2R6 = y300 ;

G2R7L = y330 ;
G2R7C1 = y338
G2R7C2 = y360
G2R7L2 = y353
G2R7 = y350 ;

G2R8L = y380 ;
G2R8C1 = y388
G2R8C2 = y410
G2R8L2 = y403
G2R8 = y400 ;

G2R9L = y430 ;
G2R9C1 = y438
G2R9C2 = y460
G2R9L2 = y453
G2R9 = y450 ;

G2C1 = x10 ; %G2C1%
G2C1B = x35 ; %G2C1B%
G2C1C = x60 ; %G2C1C%
G2C2 = x85 ; %G2C2%
G2C3 = x275 ; %G2C3%
G2C3B = x300 ; %G2C3B%
G2C3C = x325 ; %G2C3C%
G2C4 = x350 ; %G2C4%
G2C5 = x540 ; %G2C5%
G2C5B = x565 ; %G2C5B%
G2C5C = x590 ; %G2C5C%
G2C6 = x615 ; %G2C6%
G2C7 = x680 ; %G2C7%
G2C7A = x740 ; %G2C7A%

Gui 1:Show, x1590 y190 w310 h210, GoW Automation, AlwaysOnTop
Gui 1:Color, gray

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 gPixel, Pixel

Gui 1:Add, Button, %GR3% x250 w50 gAccounts2, Options

Gui 1:Add, Checkbox, x10 y80 w25 vAccountS gModeChange
Gui 1:Add, Text, vAccountMode x35 y80 w90
Gui 1:Add, Text, vCurrent x125 y80 w150

Gui 1:Add, Button, %GR3% x10 w50 gInventoryChests, Chests
Gui 1:Add, Button, %GR3% x79 w50 gCombineToggle, Combine
;Gui 1:Add, Button, %GR3% x79 w50 gRSSToggle, RSS
Gui 1:Add, Button, %GR3% x148 w50 g4GuiOpen, Donate
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%, 87H

Gui 1:font, s5
;Gui 1:font, cWhite
Gui 1:Add, Text, y135 x121, Shield   Build   Donate   Heal
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, Text, vAllianceChange y140 x130 w90
Gui 1:Add, Button, %GR2% x225 w75 gEditHelp, Edit Accounts

GuiControl,,AccountMode,%AccountMode%

Gui 2:font, s5
Gui 2:font, cBlack
Gui 2:Add, Text, %G2C1% %G2R1L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R1L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R1L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R2L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R2L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R2L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R3L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R3L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R3L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R4L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R4L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R4L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R5L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R5L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R5L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R6L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R6L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R6L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R7L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R7L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R7L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R8L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C3% %G2R8L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R8L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R9L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C5% %G2R9L%, Skip   Shield   Build
Gui 2:Add, Text, %G2C1% %G2R1L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R2L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R3L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R4L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R5L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R6L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R7L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R8L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C1% %G2R9L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R1L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R2L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R3L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R4L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R5L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R6L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R7L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C3% %G2R8L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R1L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R2L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R3L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R4L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R5L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R6L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R7L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R8L2%, Donate Heal    Move
Gui 2:Add, Text, %G2C5% %G2R9L2%, Donate Heal    Move

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, 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, cMaroon
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:font, cBlack

Gui 2:Add, Checkbox, x350 y453 vAccountQ
Gui 2:Add, Button, x375 y448 w50 gQuests, Quest

Gui 2:Add, Checkbox, %G2C1% %G2R1C1% w25 vSkipAccount1
Gui 2:Add, Checkbox, %G2C3% %G2R1C1% w25 vSkipAccount2
Gui 2:Add, Checkbox, %G2C5% %G2R1C1% w25 vSkipAccount3
Gui 2:Add, Checkbox, %G2C1% %G2R2C1% w25 vSkipAccount4
Gui 2:Add, Checkbox, %G2C3% %G2R2C1% w25 vSkipAccount5
Gui 2:Add, Checkbox, %G2C5% %G2R2C1% w25 vSkipAccount6
Gui 2:Add, Checkbox, %G2C1% %G2R3C1% w25 vSkipAccount7
Gui 2:Add, Checkbox, %G2C3% %G2R3C1% w25 vSkipAccount8
Gui 2:Add, Checkbox, %G2C5% %G2R3C1% w25 vSkipAccount9
Gui 2:Add, Checkbox, %G2C1% %G2R4C1% w25 vSkipAccount10
Gui 2:Add, Checkbox, %G2C3% %G2R4C1% w25 vSkipAccount11
Gui 2:Add, Checkbox, %G2C5% %G2R4C1% w25 vSkipAccount12
Gui 2:Add, Checkbox, %G2C1% %G2R5C1% w25 vSkipAccount13
Gui 2:Add, Checkbox, %G2C3% %G2R5C1% w25 vSkipAccount14
Gui 2:Add, Checkbox, %G2C5% %G2R5C1% w25 vSkipAccount15
Gui 2:Add, Checkbox, %G2C1% %G2R6C1% w25 vSkipAccount16
Gui 2:Add, Checkbox, %G2C3% %G2R6C1% w25 vSkipAccount17
Gui 2:Add, Checkbox, %G2C5% %G2R6C1% w25 vSkipAccount18
Gui 2:Add, Checkbox, %G2C1% %G2R7C1% w25 vSkipAccount19
Gui 2:Add, Checkbox, %G2C3% %G2R7C1% w25 vSkipAccount20
Gui 2:Add, Checkbox, %G2C5% %G2R7C1% w25 vSkipAccount21
Gui 2:Add, Checkbox, %G2C1% %G2R8C1% w25 vSkipAccount22
Gui 2:Add, Checkbox, %G2C3% %G2R8C1% w25 vSkipAccount23
Gui 2:Add, Checkbox, %G2C5% %G2R8C1% w25 vSkipAccount24
Gui 2:Add, Checkbox, %G2C1% %G2R9C1% w25 vSkipAccount25
Gui 2:Add, Checkbox, %G2C5% %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, %G2C1% %G2R1C2% w25 vDonate1
Gui 2:Add, Checkbox, %G2C3% %G2R1C2% w25 vDonate2
Gui 2:Add, Checkbox, %G2C5% %G2R1C2% w25 vDonate3
Gui 2:Add, Checkbox, %G2C1% %G2R2C2% w25 vDonate4
Gui 2:Add, Checkbox, %G2C3% %G2R2C2% w25 vDonate5
Gui 2:Add, Checkbox, %G2C5% %G2R2C2% w25 vDonate6
Gui 2:Add, Checkbox, %G2C1% %G2R3C2% w25 vDonate7
Gui 2:Add, Checkbox, %G2C3% %G2R3C2% w25 vDonate8
Gui 2:Add, Checkbox, %G2C5% %G2R3C2% w25 vDonate9
Gui 2:Add, Checkbox, %G2C1% %G2R4C2% w25 vDonate10
Gui 2:Add, Checkbox, %G2C3% %G2R4C2% w25 vDonate11
Gui 2:Add, Checkbox, %G2C5% %G2R4C2% w25 vDonate12
Gui 2:Add, Checkbox, %G2C1% %G2R5C2% w25 vDonate13
Gui 2:Add, Checkbox, %G2C3% %G2R5C2% w25 vDonate14
Gui 2:Add, Checkbox, %G2C5% %G2R5C2% w25 vDonate15
Gui 2:Add, Checkbox, %G2C1% %G2R6C2% w25 vDonate16
Gui 2:Add, Checkbox, %G2C3% %G2R6C2% w25 vDonate17
Gui 2:Add, Checkbox, %G2C5% %G2R6C2% w25 vDonate18
Gui 2:Add, Checkbox, %G2C1% %G2R7C2% w25 vDonate19
Gui 2:Add, Checkbox, %G2C3% %G2R7C2% w25 vDonate20
Gui 2:Add, Checkbox, %G2C5% %G2R7C2% w25 vDonate21
Gui 2:Add, Checkbox, %G2C1% %G2R8C2% w25 vDonate22
Gui 2:Add, Checkbox, %G2C3% %G2R8C2% w25 vDonate23
Gui 2:Add, Checkbox, %G2C5% %G2R8C2% w25 vDonate24
Gui 2:Add, Checkbox, %G2C1% %G2R9C2% w25 vDonate25
Gui 2:Add, Checkbox, %G2C5% %G2R9C2% w25 vDonate26

Gui 2:Add, Checkbox, %G2C1B% %G2R1C2% w25 vHeal1
Gui 2:Add, Checkbox, %G2C3B% %G2R1C2% w25 vHeal2
Gui 2:Add, Checkbox, %G2C5B% %G2R1C2% w25 vHeal3
Gui 2:Add, Checkbox, %G2C1B% %G2R2C2% w25 vHeal4
Gui 2:Add, Checkbox, %G2C3B% %G2R2C2% w25 vHeal5
Gui 2:Add, Checkbox, %G2C5B% %G2R2C2% w25 vHeal6
Gui 2:Add, Checkbox, %G2C1B% %G2R3C2% w25 vHeal7
Gui 2:Add, Checkbox, %G2C3B% %G2R3C2% w25 vHeal8
Gui 2:Add, Checkbox, %G2C5B% %G2R3C2% w25 vHeal9
Gui 2:Add, Checkbox, %G2C1B% %G2R4C2% w25 vHeal10
Gui 2:Add, Checkbox, %G2C3B% %G2R4C2% w25 vHeal11
Gui 2:Add, Checkbox, %G2C5B% %G2R4C2% w25 vHeal12
Gui 2:Add, Checkbox, %G2C1B% %G2R5C2% w25 vHeal13
Gui 2:Add, Checkbox, %G2C3B% %G2R5C2% w25 vHeal14
Gui 2:Add, Checkbox, %G2C5B% %G2R5C2% w25 vHeal15
Gui 2:Add, Checkbox, %G2C1B% %G2R6C2% w25 vHeal16
Gui 2:Add, Checkbox, %G2C3B% %G2R6C2% w25 vHeal17
Gui 2:Add, Checkbox, %G2C5B% %G2R6C2% w25 vHeal18
Gui 2:Add, Checkbox, %G2C1B% %G2R7C2% w25 vHeal19
Gui 2:Add, Checkbox, %G2C3B% %G2R7C2% w25 vHeal20
Gui 2:Add, Checkbox, %G2C5B% %G2R7C2% w25 vHeal21
Gui 2:Add, Checkbox, %G2C1B% %G2R8C2% w25 vHeal22
Gui 2:Add, Checkbox, %G2C3B% %G2R8C2% w25 vHeal23
Gui 2:Add, Checkbox, %G2C5B% %G2R8C2% w25 vHeal24
Gui 2:Add, Checkbox, %G2C1B% %G2R9C2% w25 vHeal25
Gui 2:Add, Checkbox, %G2C5B% %G2R9C2% w25 vHeal26

Gui 2:Add, Checkbox, %G2C1C% %G2R1C2% w25 vMove1
Gui 2:Add, Checkbox, %G2C3C% %G2R1C2% w25 vMove2
Gui 2:Add, Checkbox, %G2C5C% %G2R1C2% w25 vMove3
Gui 2:Add, Checkbox, %G2C1C% %G2R2C2% w25 vMove4
Gui 2:Add, Checkbox, %G2C3C% %G2R2C2% w25 vMove5
Gui 2:Add, Checkbox, %G2C5C% %G2R2C2% w25 vMove6
Gui 2:Add, Checkbox, %G2C1C% %G2R3C2% w25 vMove7
Gui 2:Add, Checkbox, %G2C3C% %G2R3C2% w25 vMove8
Gui 2:Add, Checkbox, %G2C5C% %G2R3C2% w25 vMove9
Gui 2:Add, Checkbox, %G2C1C% %G2R4C2% w25 vMove10
Gui 2:Add, Checkbox, %G2C3C% %G2R4C2% w25 vMove11
Gui 2:Add, Checkbox, %G2C5C% %G2R4C2% w25 vMove12
Gui 2:Add, Checkbox, %G2C1C% %G2R5C2% w25 vMove13
Gui 2:Add, Checkbox, %G2C3C% %G2R5C2% w25 vMove14
Gui 2:Add, Checkbox, %G2C5C% %G2R5C2% w25 vMove15
Gui 2:Add, Checkbox, %G2C1C% %G2R6C2% w25 vMove16
Gui 2:Add, Checkbox, %G2C3C% %G2R6C2% w25 vMove17
Gui 2:Add, Checkbox, %G2C5C% %G2R6C2% w25 vMove18
Gui 2:Add, Checkbox, %G2C1C% %G2R7C2% w25 vMove19
Gui 2:Add, Checkbox, %G2C3C% %G2R7C2% w25 vMove20
Gui 2:Add, Checkbox, %G2C5C% %G2R7C2% w25 vMove21
Gui 2:Add, Checkbox, %G2C1C% %G2R8C2% w25 vMove22
Gui 2:Add, Checkbox, %G2C3C% %G2R8C2% w25 vMove23
Gui 2:Add, Checkbox, %G2C5C% %G2R8C2% w25 vMove24
Gui 2:Add, Checkbox, %G2C1C% %G2R9C2% w25 vMove25
Gui 2:Add, Checkbox, %G2C5C% %G2R9C2% w25 vMove26

;Account Information

Gui 2:Add, Text, vLogin1 %G2C2% %G2R1% w180, %Login1%
Gui 2:Add, Text, vLogin2 %G2C4% %G2R1% w180, %Login2%
Gui 2:Add, Text, vLogin3 %G2C6% %G2R1% w180, %Login3%
Gui 2:Add, Text, vLogin4 %G2C2% %G2R2% w180, %Login4%
Gui 2:Add, Text, vLogin5 %G2C4% %G2R2% w180, %Login5%
Gui 2:Add, Text, vLogin6 %G2C6% %G2R2% w180, %Login6%
Gui 2:Add, Text, vLogin7 %G2C2% %G2R3% w180, %Login7%
Gui 2:Add, Text, vLogin8 %G2C4% %G2R3% w180, %Login8%
Gui 2:Add, Text, vLogin9 %G2C6% %G2R3% w180, %Login9%
Gui 2:Add, Text, vLogin10 %G2C2% %G2R4% w180, %Login10%
Gui 2:Add, Text, vLogin11 %G2C4% %G2R4% w180, %Login11%
Gui 2:Add, Text, vLogin12 %G2C6% %G2R4% w180, %Login12%
Gui 2:Add, Text, vLogin13 %G2C2% %G2R5% w180, %Login13%
Gui 2:Add, Text, vLogin14 %G2C4% %G2R5% w180, %Login14%
Gui 2:Add, Text, vLogin15 %G2C6% %G2R5% w180, %Login15%
Gui 2:Add, Text, vLogin16 %G2C2% %G2R6% w180, %Login16%
Gui 2:Add, Text, vLogin17 %G2C4% %G2R6% w180, %Login17%
Gui 2:Add, Text, vLogin18 %G2C6% %G2R6% w180, %Login18%
Gui 2:Add, Text, vLogin19 %G2C2% %G2R7% w180, %Login19%
Gui 2:Add, Text, vLogin20 %G2C4% %G2R7% w180, %Login20%
Gui 2:Add, Text, vLogin21 %G2C6% %G2R7% w180, %Login21%
Gui 2:Add, Text, vLogin22 %G2C2% %G2R8% w180, %Login22%
Gui 2:Add, Text, vLogin23 %G2C4% %G2R8% w180, %Login23%
Gui 2:Add, Text, vLogin24 %G2C6% %G2R8% w180, %Login24%
Gui 2:Add, Text, vLogin25 %G2C2% %G2R9% w180, %Login25%

Gui 2:Add, Button, %G2C7% %G2R0% w50 gReload, Reload
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 3:Submit, nohide

Gui 1:Add, DropDownList, %GR1% x79 w222 vLoginSelect, %DDLLogins%
Gui 2:Add, DropDownList, %G2C6% y443 w180 vLoginSelect2, %DDL2Logins%
Gui 1:Add, Button, %GR1% %GC1% w50 gQuickLog, Login

Gui 3:font, s8
Gui 3:Add, Button, x10 y10 w50 gPixel, Pixel
Gui 3:Add, Button, x79 y10 w50 gPause, Pause
Gui 3:Add, Button, x148 y10 w50 gTest, Test
Gui 3:Add, Button, x217 y10 w50 gBuildNow, Build
Gui 3:Add, Button, x10 y40 w50 gReload, Reload
Gui 3:Add, Button, x79 y40 w50 gDroid4X, Restart
Gui 3:Add, Button, x148 y40 w50 gSizeCheck, Resize

Gui 4:Add, Button, x10 y10 w50 gDonateNow, 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 x135

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, Food
Gui 4:Add, Text, y92 x225, Ore
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 vRSSFood %RSSFood%, 0
Gui 4:Add, Edit, y90 x270 w20 vRSSOre %RSSOre%, 0
GuiControl,,DonationNumbers,( %RSSCounter% / %RSSTotal% )
return

Esc::ExitApp

CheckboxSubmit:
Gui 1:Submit, nohide
Gui 2:Submit
Gui 3:Submit
return

DonateNow:
DonateMe = 1
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:+AlwaysOnTop
Gui 1:+Disabled
Gui 2:Show, x100 y100 w805 h480, Mains, AlwaysOnTop
Gui 2:Color, gray
Gui 2:Submit, nohide
return

Tools:
ToolToggle := !toggle

If (ToolToggle = 1)
{
 #Persistent
CoordMode, Pixel, Relative
SetControlDelay, 100
Gui 3:+AlwaysOnTop
Gui 3:Color, green
Gui 3:font, cBlack
Gui 3:Show, x1590 y447 w310 h75, Tools, AlwaysOnTop
Gui 3:Color, gray
Gui 3:Submit, nohide
return
 }
If (ToolToggle = 0)
{
Gui 3:Submit
Gui 3:Hide
return
}
return

3GuiOpen:
#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 100
Gui 3:+AlwaysOnTop
Gui 3:Color, green
Gui 3:font, cBlack
Gui 3:Show, x1377 y330 w208 h75, Tools, AlwaysOnTop
Gui 3:Color, gray
Gui 3:Submit, nohide
return

4GuiOpen:
#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 100
Gui 4:+AlwaysOnTop
Gui 4:Color, teal
Gui 4:font, cBlack
Gui 4:Show, x1590 y447 w310 h120, Donate, AlwaysOnTop
GuiControl,,DonationNumbers,( %RSSCounter% / %RSSTotal% )
Gui 4:Submit, nohide
return

2GuiClose:
Gui 1:-Disabled
Gui 2:Submit
Gui 2:Hide
Return

3GuiClose:
Gui 3:Submit
Gui 3:Hide
Return

4GuiClose:
Gui 4:Submit
Gui 4: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:
ToggleShieldAll := !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

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%
 if(!ErrorLevel)
 {
  Process, Close, Droid4X.exe
  sleep, 5000
;  gosub, ShutdownDroid4X
 }

return

StartupDroid4X:
;Process, Exist, %AppVer%
; If(!ErrorLevel)
;  {
;   return
;  }
; else
;  {
   Run "C:\Program Files (x86)\Droid4X0.8.2\Droid4X\Droid4X.exe" ;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:
GuiControl,,AccountMode,Paused
Pause
return

Reload:
Reload
Sleep 2000
return

CombineToggle:
 If(toggleCm)
  {
   toggleCm := false
   goto, CombineDone
  }
 else
  {
   toggleCm := true
   goto, CombineBox
  }
return

CombineBox:
MsgBox, 4,, To combine open your Forge, select the page you wish to combine,`nand scroll to the bottom.  Do you want to combine?
 IfMsgBox Yes
  {
   toggleCm := !toggle
   goto, BeginCombine
  }
 Else
  toggleCm := false
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:
toggleCm := !toggle
 If(toggleCh)
  {
   toggleCh := false
  }
 Else
  {
   toggleCh := true
   GuiControl,,AccountMode,Changing
   goto, LChange
  }
return

Halt:
return

RandomWait:
Random, n, 2000, 4000
n = %sleep%
sleep, %sleep%
return

RandomWait1:
Random, n, 1000, 1500
n = %sleep%
sleep, %sleep%
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

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

xTest:
IfWinExist, %AppVer%
 WinActivate
 gosub, RandomWait
PixelSearch, Px, Py, 75, 125, 450, 600, 0x2C3FDF, 5, Fast
 If ErrorLevel = 0
  {
;   Py += 50
   ControlClick, x%Px% y%Py%, %AppVer% ;Outlander City
   sleep, 3000
  }
gosub, CityPopup
return

EditMe:
RunWait,"C:\WINDOWS\system32\notepad.exe" "%A_ScriptFullPath%"
IfWinExist GoWScript.ahk - Notepad
 {
  WinActivate
 }
return

;------Cycle Accounts------------------------------------------------------------

CycleAccounts:
;GuiControl,,Current,%Login%
IfWinExist, %AppVer%
 WinActivate
else
{
 Run "C:\Program Files (x86)\Droid4X0.8.2\Droid4X\Droid4X.exe" ;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 "C:\Program Files (x86)\Droid4X0.8.2\Droid4X\Droid4X.exe" ;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

IfWinExist, %AppVer%
 WinActivate
sleep, 200
gosub, sizecheck
sleep, 4000
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:
;Continued in Part 2



Malechite
  • Members
  • 23 posts
  • Last active: Sep 04 2016 08:02 PM
  • Joined: 30 Jul 2015

;GoW Automation Part 2 of 3

;continued from Part 1
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, Build1, 2:
GuiControlGet, Build2, 2:
GuiControlGet, Build3, 2:
GuiControlGet, Build4, 2:
GuiControlGet, Build5, 2:
GuiControlGet, Build6, 2:
GuiControlGet, Build7, 2:
GuiControlGet, Build8, 2:
GuiControlGet, Build9, 2:
GuiControlGet, Build10, 2:
GuiControlGet, Build11, 2:
GuiControlGet, Build12, 2:
GuiControlGet, Build13, 2:
GuiControlGet, Build14, 2:
GuiControlGet, Build15, 2:
GuiControlGet, Build16, 2:
GuiControlGet, Build17, 2:
GuiControlGet, Build18, 2:
GuiControlGet, Build19, 2:
GuiControlGet, Build20, 2:
GuiControlGet, Build21, 2:
GuiControlGet, Build22, 2:
GuiControlGet, Build23, 2:
GuiControlGet, Build24, 2:
GuiControlGet, Build25, 2:
GuiControlGet, Build26, 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, ShieldNow, 1:
GuiControlGet, BuildNow, 1:
GuiControlGet, DonatedNow, 1:
GuiControlGet, HealNow, 1:

If varLogin = %Login1%
 {
  toggleCh := false
  If (SkipAccount1 = 1)
   varLogin = %Login2%
  If (SkipAccount1 = 0)
  {
   Login = %Login1%
   pwd = %pwd1%
   vNext = %Login2%
   vID = 1
  }
  If login = name@gmail.com
   {
    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%
   vID = 16
  }
   vNext = %Login17%
  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 = unused
   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 = unused
   varLogin = %vNext%
 }
If varLogin = %Login26%
 {
  If (SkipAccount26 = 1)
   varLogin = 56
  If (SkipAccount26 = 0)
  {
   login = %Login26%
   pwd = %pwd26%
   vNext = %Login27%
   vID = 26
   }
   If login = name+01@gmail.com
   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
 {
  BuildMe := 0
  ShieldMe := 0
  HealMe := 0
  MoveMe := 0
  Full++
  varLogin = %Login1%
  gosub, Droid4X
  goto, CycleAccounts
  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 (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
  toggleL := 0
  toggleA := 1
  toggleB := 1
  BeepCounter := 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 (DonateMe = 1)
 {
  If (toggleDn = 0)
   {
    goto, 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
  }
 Else
  {
   gosub, VQ1
   return
  }
gosub, CityScreen
return

QuestCheck:
GuiControlGet, AccountQ, 2:
IfWinExist, %AppVer%
 WinActivate
   sleep, 1000
gosub, QuestHome
   sleep, 1000

PixelSearch, Px, Py, 404, 206, 414, 206, 0x0CD500, 100, Fast
 If ErrorLevel = 0
  {
   ControlClick, x404 y206, %AppVer% ;select Empire Quest Tab
   sleep, 1000
   gosub, EQ1
  }

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
  }

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
  }

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
     }
   PixelSearch, Px, Py, 420, 230, 420, 230, 0x002C00, 0, Fast
    If ErrorLevel = 0
    {
     gosub, VQ1
    }
   PixelSearch, Px, Py, 420, 230, 420, 230, 0x474100, 0, Fast
    If ErrorLevel = 0
    {
     gosub, VQ1
    }
  }
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, MoreMenuWait
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
sleep, 4000
PixelGetColor, color, 360, 360, %AppVer% ;Gold Max Attack Mode Button
 If Color = 0x0F5CAB
  {
   gosub, CityScreen
   return
  }
PixelGetColor, color, 350, 575, %AppVer% ;Gold Max Attack Mode Button
 If Color = 0x0F5CAB
  {
   ControlClick, x250 y300, %AppVer% ;Monster Image
   sleep, 3000
   PixelGetColor, color, 365, 565, %AppVer% ;Gold Max Attack Mode Button
    If Color = 0x0F5CAB
     {
      gosub, CityScreen
      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, 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

;------Inventory Functions------

MoreMenuWait:
sleep, 3000
PixelSearch, Px, Py, 320, 220, 320, 220, 0x4AA723, 10, Fast
 If ErrorLevel != 0
  {
   ControlClick, x425 y700, %AppVer% ;select Items
   gosub, RandomWait
   goto, MoreMenuWait
   return
  }
return

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

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

;Continued in Part 3



Malechite
  • Members
  • 23 posts
  • Last active: Sep 04 2016 08:02 PM
  • Joined: 30 Jul 2015

;Continued from Part 2

;Continued from Part 2
xyz:
PixelSearch, Px, Py, 120, 190, 400, 550, 0x474100, 0, Fast
 If ErrorLevel != 0
  {
   SetTimer, InactivityX2, off
   goto, CityScreen
  }
return

unuseddungeon:
PixelSearch, Px, Py, 400, 150, 400, 600, 0x002C00, 0, Fast
 If ErrorLevel = 0
  {
   SetTimer, InactivityX2, off
   goto, CityScreen
   return
  }
PixelSearch, Px, Py, 325, 350, 325, 350, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x325 y350, %AppVer%
   gosub, RandomWait
   goto, MoreDungeonWait1
   return
  }
PixelSearch, Px, Py, 150, 300, 400, 575, 0x474100, 0, Fast
 If ErrorLevel != 0
  {
   ControlClick, x120 y320, %AppVer%
   gosub, RandomWait
   goto, MoreDungeonWait1
   return
  }
   SetTimer, InactivityX2, off
   goto, CityScreen
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
  }

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

MyItemsWait:
   gosub, RandomWait
PixelSearch, Px, Py, 375, 50, 375, 50, 0x010427, 5, Fast
 If ErrorLevel = 0
  {
   ControlClick, x430 y50, %AppVer% ;select Items
   sleep, 2000
   gosub, ItemsWait
   sleep, 2000
   goto, MyItemsWait
  }
PixelSearch, Px, Py, 300, 175, 300, 175, 0xFFFFFF, 5, Fast
 If ErrorLevel = 0
  {
   gosub, ItemsWait
   sleep, 2000
   goto, MyItemsWait
  }
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, MyItemsWait
  }
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

TreasureItemsWait:
   gosub, RandomWait
PixelSearch, Px, Py, 430, 235, 430, 235, 0x01031E, 3, Fast
 If ErrorLevel = 0
  {
   return
  }
PixelSearch, Px, Py, 430, 235, 430, 235, 0x01031E, 3, Fast
 If ErrorLevel != 0
  {
   ControlClick, x430 y225, %AppVer% ;select Treasures
   gosub, RandomWait
   goto, TreasureItemsWait
  }
return

 

;------Combine------

BeginCombine:
IfWinExist, %AppVer%
 WinActivate
gosub, resize
gosub, RandomWait
SetTimer, Slot4R3, 3000
return

CombineDone:
IfWinExist, %AppVer%
 WinActivate
SetTimer, Slot4R3, off
MsgBox, Completed.
gosub, RandomWait
gosub, CityScreen
toggle := 1
gosub, TimersOn
goto, CheckPixelColor
return

CombineCheck:
gosub, RandomWait
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
  {
   gosub, RandomWait
   goto, CombineCheck
   return
  }
goto, CombineCheck2
return

CombineCheck2:
gosub, RandomWait
PixelGetColor, color, 345, 590, %AppVer%
 If Color = 0x424447
  {
   gosub, RandomWait
   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
  }

gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
return

;Row 3

Slot4R3:
ControlClick, x400 y500, %AppVer% ;Slot4
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot3R3
 If Color != 0x424447
  goto, CombineCheck
return

Slot3R3:
ControlClick, x300 y500, %AppVer% ;Slot3
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot2R3
 If Color != 0x424447
  goto, CombineCheck
return

Slot2R3:
ControlClick, x200 y500, %AppVer% ;Slot2
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot1R3
 If Color != 0x424447
  goto, CombineCheck
return

Slot1R3:
ControlClick, x100 y500, %AppVer% ;Slot1
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot4R2
 If Color != 0x424447
  goto, CombineCheck
return

;Row2

Slot4R2:
ControlClick, x400 y400, %AppVer% ;Slot4
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot3R2
 If Color != 0x424447
  goto, CombineCheck
return

Slot3R2:
ControlClick, x300 y400, %AppVer% ;Slot3
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot2R2
 If Color != 0x424447
  goto, CombineCheck
return

Slot2R2:
ControlClick, x200 y400, %AppVer% ;Slot2
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot1R2
 If Color != 0x424447
  goto, CombineCheck
return

Slot1R2:
ControlClick, x100 y400, %AppVer% ;Slot1
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot4R1
 If Color != 0x424447
  goto, CombineCheck
return

;Row 1

Slot4R1:
ControlClick, x400 y300, %AppVer% ;Slot4
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot3R1
 If Color != 0x424447
  goto, CombineCheck
return

Slot3R1:
ControlClick, x300 y300, %AppVer% ;Slot3
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot2R1
 If Color != 0x424447
  goto, CombineCheck
return

Slot2R1:
ControlClick, x200 y300, %AppVer% ;Slot2
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, Slot1R1
 If Color != 0x424447
  goto, CombineCheck
return

Slot1R1:
ControlClick, x100 y300, %AppVer% ;Slot1
gosub, RandomWait
PixelGetColor, color, 300, 580, %AppVer%
 If Color = 0x424447
  goto, MoveMouse
 If Color != 0x424447
  goto, CombineCheck
return

MoveMouse:
IfWinExist, %AppVer%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 100, 300, down}
gosub, RandomWait
SendEvent {click 100, 500, up}
gosub, RandomWait
return

;------Open Chests------

InventoryChests:
IfWinExist, %AppVer%
 WinActivate
gosub, resize
gosub, RandomWait
gosub, TimersOff
gosub,  ItemsWait
gosub, RandomWait
gosub, MyItemsWait
gosub, RandomWait
gosub, TreasureItemsWait
gosub, RandomWait
gosub, OpenChests
return

RSSToggle:
If(toggleOC)
 {
  toggleOC := false
  goto, StopChests
 }
else
 {
  toggleOC := true
  goto, OpenChests
 }
return

StopChests:
SetTimer, OpenChests1, off
SetTimer, OpenChests2, off
MsgBox, Completed.
gosub, RandomWait
gosub, CityScreen
toggle := 1
gosub, TimersOn
goto,  CycleSubs
return

OpenChests:
IfWinExist, %AppVer%
 WinActivate
PixelGetColor, color, 400, 200, %AppVer%
 If Color = 0x002C00
  {
   gosub, OpenChests2
   SetTimer, OpenChests2, 500
  }
 else
  {
   gosub, OpenChests1
   SetTimer, OpenChests1, 500
  }
return

OpenChests1:
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
  }

PixelGetColor, color, 408, 222, %AppVer%
 If (Color = 0x05052D or Color = 0xDCDCDC)
  {
   ControlClick, x408 y222, %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:
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, MyItemsWait
   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

;285
;325

;Shap0opy

DonateRSS:
  GuiControl,,AccountMode,Donating
  Gosub, mapscreen
  gosub, RandomWait
  Gosub, CenterCity
  gosub, RandomWait
  RSSCounter++
  GuiControl,,DonationNumbers,( %RSSCounter% / %RSSTotal% )
  goto, DonateRSS2
return

DonateRSS2:
  gosub, SelectCenterCity
  gosub, DonateButton
  gosub, DonateScreen

  goto, AddRss
  MarchSlots++
  gosub, RandomWait
return

CenterCity:
GuiControlGet, DonateAC, 2:
GuiControlGet, Xcoord, 2:
GuiControlGet, Ycoord, 2:

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:
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:
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:
sleep, 2000
PixelGetColor, color, 225, 320, %AppVer% ;Red Cancel Button
 If Color = 0x030839
  {
   ControlClick, x300 y315, %AppVer% ;Goto Button
   goto, GotoCoords
  }
return

SelectCenterCity:
GuiControlGet, DonateAC, 2:
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:
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:
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, DonateAC, 2:
If (RSSCounter = 0)
  {
   TraidWait := 0
   ControlClick, x100 y700, %AppVer%
   gosub, RandomWait
   toggleDn := 1
   goto, CityScreen
   BeepCounter := 0
   goto, CycleSubs
   return
  }
gosub, DonateRSSBegin
return

DonateRSSBegin:
RSSNext = Stone
If (RSSCounter > RSSTotal)
  {
   return
  }
If (RSSCounter <= RSSTotal)
  {
   goto, Donate%RSSNext%
  }
return

DonateStone:
RSSName = Stone
RSSNext = Wood
Ry1 = 160
Rx1 = 350
goto, AddRSS2
return

DonateWood:
RSSName = Wood
RSSNext = Ore
Ry1 = 210
Rx1 = 350
goto, AddRSS2
return

DonateOre:
RSSName = Ore
RSSNext = Food
Ry1 = 260
Rx1 = 350
goto, AddRSS2
return

DonateFood:
RSSName = Food
RSSNext = Silver
Ry1 = 310
Rx1 = 285
goto, AddRSS2
return

DonateSilver:
RSSName = Silver
RSSNext = Finished
goto, AddRSS2
return

DonateFinished:
goto, AddRSS2
return

AddRSS2:
If (RSSCounter > RSSTotal)
  {
   RSSCounter := 0
   gosub, CityScreen
   DonateMe := 0
   goto, cyclesubs
  }
If (RSSCounter%RSSName% = 0)
 {
  goto, Donate%RSSNext%
 }
If (RSSCounter%RSSName% >= RSS%RSSName%)
  {
   goto, Donate%RSSNext%
  }

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:
SetDefaultMouseSpeed, 10
SendEvent {Click 130, %Ry1%, down}
gosub, RandomWait
SendEvent {Click %Rx1%, %Ry1%, up}
return

SubtractRSS:
gosub, RandomWait
SetDefaultMouseSpeed, 10
SendEvent {Click 300, %Ry1%, down}
gosub, RandomWait
SendEvent {Click 77, %Ry1%, up}
return

TradeConfirm:
GuiControlGet, DonateAC, 2:
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
  {
   RSSCounter++
   TraidWait := 0
   RSSCounter%RSSName% = RSS%RSSName%
   RSSCounter%RSSName%++
   gosub, RandomWait
    If (DonateAC = 1)
     {
      goto, Donate%RSSNext%
     }
    If (DonateAC = 0)
     {
      sleep, 5000
      goto, DonateRSS2
     }
  }
GuiControl,,DonationNumbers,( %RSSCounter% / %RSSTotal% )
TraidWait := 0
RSSCounter++
RSSCounter%RSSName%++
gosub, RandomWait
If (DonateAC = 1)
 {
  goto, Donate%RSSNext%
 }
If (DonateAC = 0)
 {
  sleep, 5000
  goto, DonateRSS2
 }
return

MaxMarchLimitWait:
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)
        RSSCounter := 0
        gosub, CityScreen
        DonateMe := 0
        goto, cyclesubs
       }
     }
  }
return

Test:
;Research
IfWinExist, %AppVer%
 WinActivate
gosub, MoreMenuWait
sleep, 3000
gosub, ResearchMenuWait
sleep, 3000
gosub, ResearchMenuSelect
sleep, 3000
gosub, ResearchMenuEnter
msgbox, Done
return

ztest:
PixelSearch, Px, Py, 380, 380, 380, 380, 0x474100, 0, Fast
 If ErrorLevel != 0
  {
   PixelSearch, Px1, Py1, 75, 125, 450, 600, 0x252E56, 5, Fast
    If ErrorLevel = 0
     {
       ;msgbox, x%Px1%
      Px1 += 6
     
      PixelSearch, Px, Py, %Px1%, %Py1%, %Px1%, %Py1%, 0x2330D8, 2, Fast
       msgbox, x%Px1% y%Py1%
       If ErrorLevel = 0
        {
;      ControlClick, x%Px% y%Py%, %AppVer% ;Outlander City
      sleep, 3000
      msgbox, x%Px% y%Py%
;      gosub, Test
        }
     }
    else
     msgbox, Not found.
  }
return

FindOutlanderCity:
IfWinExist, %AppVer%
 WinActivate
 gosub, RandomWait
PixelSearch, Px, Py, 380, 380, 380, 380, 0x474100, 0, Fast
 If ErrorLevel != 0
  {
   PixelSearch, Px1, Py1, 75, 125, 450, 600, 0x252E56, 5, Fast
    If ErrorLevel = 0
     {
       ;msgbox, x%Px1%
      Px1 += 6
     
      PixelSearch, Px, Py, %Px1%, %Py1%, %Px1%, %Py1%, 0x2330D8, 2, Fast
       msgbox, x%Px1% y%Py1%
       If ErrorLevel = 0
        {
;      ControlClick, x%Px% y%Py%, %AppVer% ;Outlander City
      sleep, 3000
      msgbox, x%Px% y%Py%
;      gosub, Test
        }
     }
    else
     msgbox, Not found.
  }
;gosub, CityPopup
return

CityPopup:
 gosub, RandomWait
PixelSearch, Px, Py, 380, 380, 380, 380, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x380 y380, %AppVer% ;Popup Attack Button
   sleep, 3000
   gosub, CityPopup
  }
return

AttackPopup:
 gosub, RandomWait
PixelSearch, Px, Py, 165, 253, 165, 253, 0x474100, 0, Fast
 If ErrorLevel = 0
  {
   ControlClick, x380 y380, %AppVer% ;Peace Shield Button
   sleep, 3000
   msgbox, Player Has Active Shield
return
;   gosub, AttackPopup
  }
return

;Research Functions

; x80 y100 0x0B0E10 or 040505

ResearchMenuSelect:
If (ResearchCounter = 0)
  {
   ControlClick, x100 y700, %AppVer%
   gosub, RandomWait
   goto, CityScreen
   goto, CycleSubs
   return
  }
;Research Menu First Row
If (ResearchCounter = 1)
  {
   RCx1 = 100
   RCy1 = 225
  }
;Research Menu Second Row
If (ResearchCounter = 2)
  {
   RCx1 = 100
   RCy1 = 300
  }
If (ResearchCounter = 3)
  {
   RCx1 = 100
   RCy1 = 375
  }
If (ResearchCounter = 4)
  {
   RCx1 = 100
   RCy1 = 425
  }
If (ResearchCounter = 5)
  {
   RCx1 = 100
   RCy1 = 500
  }
If (ResearchCounter = 6)
  {
   RCx1 = 100
   RCy1 = 575
  }
If (ResearchCounter = 7)
  {
ResearchCounter = 0
goto, ResearchMenuSelect
  }
return

ResearchMenuEnter:
sleep, 3000
PixelSearch, Px, Py, 80, 100, 80, 100, 0x0B0E10, 20, Fast
 If ErrorLevel != 0
  {
   ControlClick, x%RCx1% y%RCy1%, %AppVer%
   goto, ResearchMenuEnter
  }
return

 

;End of Script
 



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

use a code box and post your other scripts in the gaming function section plz
 

like this

like this

  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

LorDDaniMax
  • New members
  • 3 posts
  • Last active: Jul 31 2015 12:20 AM
  • Joined: 30 Jul 2015
Can you make me a favour? I have a game very similar calles DeadWalk and i would like The Script from GoW for training troops infinity, or if you could do one for me from that game :D
Its very similar, i did it but i dont know how to repeat it infinitly again when training finishes because its time depends of The helps of other members, just like GoW,can you help me please? I give you The needed coords:
142,247 open militia training menĂº
180,521 click on train militia button
272,636 click on "ask for help" button
I saw something what uses colores for this type of Script, maybe you need it, in ask for help button appears a button to finish training with premium money which colours are primary yellow, then white, green, and black
This is The only thing i want from this program, help me if you can please!

Malechite
  • Members
  • 23 posts
  • Last active: Sep 04 2016 08:02 PM
  • Joined: 30 Jul 2015

Can you make me a favour? I have a game very similar calles DeadWalk and i would like The Script from GoW for training troops infinity, or if you could do one for me from that game :D
Its very similar, i did it but i dont know how to repeat it infinitly again when training finishes because its time depends of The helps of other members, just like GoW,can you help me please? I give you The needed coords:
142,247 open militia training menĂº
180,521 click on train militia button
272,636 click on "ask for help" button
I saw something what uses colores for this type of Script, maybe you need it, in ask for help button appears a button to finish training with premium money which colours are primary yellow, then white, green, and black
This is The only thing i want from this program, help me if you can please!

I'm not sure about DeadWalk, but here is a working script to train troops perpetually for Game of War, and the tools you would need to modify it to your needs. You should be able to pull what you need.

#Persistent
CoordMode, Pixel, Relative
SetControlDelay, 200
Gui 1:Add, Button, x10 y10 w50 gStart, On/Off
Gui 1:Add, Button, x70 y10 w50 gPixel, Pixel
Gui 1:Add, Button, x190 y10 w50 gReload, Reload

Gui 1:font, s8
Gui 2:font, cNavy
Gui 1:Add, Radio, checked x10 y50 altsubmit gPickTroop vTroopType, Swordsmen
Gui 1:Add, Radio, x90 y50 altsubmit gPickTroop, Slingers
Gui 1:Add, Radio, x170 y50 altsubmit gPickTroop, Outriders
Gui 1:Add, Radio, x10 y70 altsubmit gPickTroop, Ram
Gui 1:Add, Radio, x90 y70 altsubmit gPickTroop, Hoplites
Gui 1:Add, Radio, x170 y70 altsubmit gPickTroop, Skirmish
Gui 1:Add, Radio, x10 y90 altsubmit gPickTroop, Light Cav.
Gui 1:Add, Radio, x90 y90 altsubmit gPickTroop, Ballista
Gui 1:Add, Radio, x170 y90 altsubmit gPickTroop, Pikeman
Gui 1:Add, Radio, x10 y110 altsubmit gPickTroop, Guardians
Gui 1:Add, Radio, x90 y110 altsubmit gPickTroop, Comp. Cav.
Gui 1:Add, Radio, x170 y110 altsubmit gPickTroop, Seige Twr
Gui 1:Add, Radio, x10 y130 altsubmit gPickTroop, Immortals
Gui 1:Add, Radio, x90 y130 altsubmit gPickTroop, Marksman
Gui 1:Add, Radio, x170 y130 altsubmit gPickTroop, War Eleph.
Gui 1:Add, Radio, x10 y150 altsubmit gPickTroop, Onager
Gui 2:font, cMaroon
Gui 1:Add, Radio, x10 y170 altsubmit gPickTroop, Spearmen
Gui 1:Add, Radio, x90 y170 altsubmit gPickTroop, Hunters
Gui 1:Add, Radio, x170 y170 altsubmit gPickTroop, Chariots
Gui 1:Add, Radio, x10 y190 altsubmit gPickTroop, Peltasts
Gui 1:Add, Radio, x90 y190 altsubmit gPickTroop, Rangers
Gui 1:Add, Radio, x170 y190 altsubmit gPickTroop, Scyth Char.
Gui 1:Add, Radio, x10 y210 altsubmit gPickTroop, Phalangite
Gui 1:Add, Radio, x90 y210 altsubmit gPickTroop, Stalkers
Gui 1:Add, Radio, x170 y210 altsubmit gPickTroop, Lancers
Gui 1:Add, Radio, x10 y230 altsubmit gPickTroop, Legionnaires
Gui 1:Add, Radio, x90 y230 altsubmit gPickTroop, Dianas
Gui 1:Add, Radio, x170 y230 altsubmit gPickTroop, Cataphracts
Gui 2:font, cBlack

Gui 1:font, s10
Gui 1:Submit, nohide
Gui 1:Show, x100 y100 w250 h250, Train, AlwaysOnTop

;Examples only, use the pixel color search to identify the hex color and locations needed.

;EmulatorWindowName = BlueStacks App Player
EmulatorWindowName = Droid4X 0.8.3 Beta
toggleP := 0
toggleTrain := 0
TroopPage := 1
TroopRow := 1
TroopLocation = x125 y350

; Control+Alt+Z hotkey to toggle pixel color search.
; If "Q" is pressed, the individual script sub stops.

Esc::ExitApp

1GuiClose:
ExitApp
return

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

^!z::  ; Control+Alt+Z hotkey.
;This is my favored tool to use when getting pixel colors.
PixelFreeze:
SetTimer, ContinuousPixelColor, Off
Return

Pixel:
 If(toggleP)
  {
   toggleP := 0
   SetTimer, ContinuousPixelColor, off
   sleep, 1000
   ToolTip,
  }
 Else
  {
   toggleP := 1
   SetTimer, ContinuousPixelColor, 100
  }
return
ContinuousPixelColor:
GetKeyState, state, q
 If state = D
 {
  toggleP := 0
  SetTimer, ContinuousPixelColor, off
  ToolTip, 
  return
 }
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%
WinGetTitle, Title, A
ToolTip, ahk_id: %WhichWindow%`n%WhichControl%`n%Title%`nX%MouseX%`tY%MouseY%`n%color%`nRed:%vred%`tBlue:%vblue%`tGreen:%vgreen%`n%OutputVar%
return

Reload:
Reload
Sleep 2000
return

Start:
 If(toggleTrain)
  {
   toggleTrain := 0
   SetTimer, TrainingCheck, off
   sleep, 1000
  }
 Else
  {
   toggleTrain := 1
   SetTimer, TrainingCheck, 10000
   goto, TrainingCheck
  }
return

^!a::  ; Control+Alt+A hotkey.
Train:
GetKeyState, state, q
 If state = D
 {
  return
 }
SetTimer, TrainingCheck, off
IfWinExist, %EmulatorWindowName%
 {
  WinActivate
  sleep, 1000
  gosub, Resize
  sleep, 1000
  gosub, MainScreen
  sleep, 1000
  gosub, MoreMenu
  sleep, 1000
  gosub, TrainMenu
  sleep, 1000
  gosub, SelectTroops
  sleep, 1000
  gosub, TrainTroops
  sleep, 1000
  gosub, MainScreen
  sleep, 1000
  SetTimer, TrainingCheck, 10000
  return
  }
 Else
  {
   MsgBox, Emulator not detected.
  }
Return


;I typically resize the window to ensure I'm always looking in the right spot.

Resize:
GetKeyState, state, q
 If state = D
 {
  return
 }
IfWinExist, %EmulatorWindowName%
 WinActivate
 sleep, 2000
WinGetPos,X,Y,W,H,A
If w != 460
 {
  WinMove,A,,,,460,730
  goto, Resize
 }
Return

MainScreen:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  return
 }
sleep, 2000
PixelSearch, Px, Py, 150, 50, 150, 50, 0x101427, 50, Fast ;X:Y location of a pixel that is always the color "0x101427" when not on the home screen.
 If ErrorLevel = 0
  {
   ControlClick, x100 y700, %EmulatorWindowName% ;Bottom Menu City/Map icon
   goto, MainScreen
  }
Return

MoreMenu:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  return
 }
sleep, 2000
PixelSearch, Px, Py, 310, 220, 320, 230, 0x4AA722, 10, Fast ; Green "MZ Logo" on More Menu
 If ErrorLevel != 0
  {
   ControlClick, x425 y700, %EmulatorWindowName% ;More Menu Icon Location
   sleep, 1000
   goto, MoreMenu
   return
  }
return

TrainMenu:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  return
 }
sleep, 2000
PixelSearch, Px, Py, 420, 170, 420, 170, 0x474100, 0, Fast ;Upgrade Button on "Barracks" screen
 If ErrorLevel != 0
  {
   ControlClick, x215 y400, %EmulatorWindowName% ;Train Menu Icon location in More Menu
   sleep, 1000
   goto, TrainMenu
   return
  }
return

SelectTroops:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  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%, %EmulatorWindowName%
   sleep, 3000
   goto, TrainTroops
   return
  }
goto, TrainMenu
return

TroopPage2:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  return
 }
sleep, 2000
PixelSearch, Px, Py, 300, 235, 300, 235, 0x586773, 10, Fast ;Grayed out Strategic Troops tab
 If ErrorLevel = 0
  {
   ControlClick, x300 y235, %EmulatorWindowName%
   goto, TroopPage2
  }
return

TroopRowUp:
IfWinExist, %EmulatorWindowName%
 WinActivate
SetDefaultMouseSpeed, 10
SendEvent {Click 330, 555, down}
sleep, 2000
SendEvent {click 370, 440, up}
sleep, 2000
return

TrainTroops:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  return
 }
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, %EmulatorWindowName%
   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, %EmulatorWindowName% ;Train Button on "Barracks" screen
   goto, TrainTroops
  }
return

AlreadyTraining:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  Return
 }
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, %EmulatorWindowName%
   sleep, 2000
   ControlClick, x80 y100, %EmulatorWindowName% ;Blank space in upper right hand corner of window
   goto, AlreadyTraining
  }
Return

TrainingCheck:
IfWinExist, %EmulatorWindowName%
 WinActivate
GetKeyState, state, q
 If state = D
 {
  MsgBox, No Longer Searching.
  Return
 }

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
           {
            SetTimer, TrainingCheck, Off
            goto, Train
           }
        }
     }
  }
return


Malechite
  • Members
  • 23 posts
  • Last active: Sep 04 2016 08:02 PM
  • Joined: 30 Jul 2015
I believe the piece you are looking for is at the end of the script.
GoW has specific icons that precede the "timer bar" for all of its functions.
I search for two correlative colors (usually within 10-20 shades), in two of the games pre-determined locations for the first two timer bar locations, and if they equal true, (i.e. the colors exist in all locations) it terminates the sub.
The "SetTimer" function looks for the absence of the "training icon" at predetermined intervals, and activates the troop train function if they are not found.
An item of note, is that due to the design of most of the emulators/simulators, a "click" command will only be accepted if Autohotkey is set to run as an administrator.
I personally bypass this feature by going into Autohotkey's root folder location, and setting the application to run as administrator for all users in Advanced - Compatibility.

Malechite
  • Members
  • 23 posts
  • Last active: Sep 04 2016 08:02 PM
  • Joined: 30 Jul 2015
I have posted the script after some fixes and requested functions from the community under the Gaming Scripts section where it belongs. If you are going to use one, please go there. The GUI, subs, and variable usage alone are handy for almost any mobile game using an emulator, or could at lease help you get a lot of the startup info in one spot.

Malechite
  • Members
  • 23 posts
  • Last active: Sep 04 2016 08:02 PM
  • Joined: 30 Jul 2015

The newest script is posted in it's entirety on pastebin under the name Game of War (GoW) Automation.



mydanno
  • Members
  • 6 posts
  • Last active: Sep 26 2015 05:22 AM
  • Joined: 15 Sep 2015

Hello Malechite

 

Is it possible for this to work on other simulators?

Can you contact me for work on this script? I am willing to pay for your time.

 

Thanks

Danno



emmettjames
  • New members
  • 1 posts
  • Last active: Sep 17 2015 09:32 PM
  • Joined: 17 Sep 2015

I can't get this script to work. Should it open the Droid4X application when Hotkey is executed?



mydanno
  • Members
  • 6 posts
  • Last active: Sep 26 2015 05:22 AM
  • Joined: 15 Sep 2015

I have attempted to modify what emulator the script opens but it does not open Droid4X. I have it pointing to the right directory but no luck. Any guidance appreciated or if someone wants to make some money I would gladly pay.



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

hi

 

what version of Droid4X do you have?

what OS do you use?

whats your resolution?


  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

mydanno
  • Members
  • 6 posts
  • Last active: Sep 26 2015 05:22 AM
  • Joined: 15 Sep 2015

hi

 

what version of Droid4X do you have?

what OS do you use?

whats your resolution?

 

Hey SnowFlake

 

Droid4X Beta 8.4

Win 7 Pro 64bit

1920x1080



Ragjr2003
  • Members
  • 9 posts
  • Last active: Oct 25 2015 03:01 PM
  • Joined: 06 Oct 2015

Hello I had a few questions about how to actually get this to run on the Droid4X 0.8.5 simulator

 

I need it kind of simply put as I am not the most tech savvy of individuals and I just started playing with the Droid simulator today because of this post

 

Any help is welcomed from any experience level

 

Also

 

Is there a way that you could shorten down the script a little so that we could run just 1 account as a tester rather then having the 3000 lines of extra in there for  the other 60 accounts that are not being used?