setThrowException(False)
restStop = Pattern(
).targetOffset(0,20)
gamebox = Region(SCREEN)
def skipButton():
s = 0
while (exists(
,0) or exists(
,0) or exists(
,0) or exists(
,0)) and not exists(Pattern(
).similar(0.90),0):
s = s + 1
click(
)
click(
)
click(
)
click(
)
if s == 10:
refreshPage()
if exists(Pattern(
).similar(0.90),0):
helpingtimer = 0.5
click(Pattern(
).similar(0.90))
wait(helpingtimer*4)
click(Pattern(
).similar(0.90))
wait(helpingtimer)
click(
)
wait(helpingtimer)
click(
)
rest()
def refreshPage():
gamebox = Region(SCREEN)
switchApp("Social City on Facebook")
click(Pattern(
).targetOffset(-20,0))
type(Key.F5)
wait(2)
wait(Pattern(
).similar(0.82).targetOffset(-62,0), 10)
click(getLastMatch())
type(Key.HOME)
wait(
,30)
for i in range(1, 6):
type(Key.DOWN)
wait(0.2)
wait(
,5)
(rx, ry, rw, rh) = (getLastMatch().getX()-3, getLastMatch().getY()-1, 760, 650)
setROI(rx, ry, rw, rh)
gamebox = Region(rx, ry, rw, rh)
skipButton()
rest()
relocate()
def relocate():
#to do:
#random number 1 through 4
#make each number a direction
#random distance (time to keep pressed)
direction = 1
distance = 0 #85
x=0
y=0
if direction==1:
x=-distance
if direction==2:
y=-distance
if direction==3:
x=distance
if direction==4:
y=distance
dragDrop(Pattern(
).targetOffset(0,150), Pattern(
).targetOffset(x,150+y))
def rest():
hover(restStop)
def clickAll(tag):
if exists(tag,0):
skipButton()
while exists(tag,0):
click(tag)
skipButton()
def buyContract(tag):
if exists(tag,0):
skipButton()
while exists(tag,0):
click(tag)
click(
)
skipButton()
def main():
rest()
skipButton()
clickAll(
)
clickAll(
)
clickAll(
)
clickAll(
)
if exists(
,0) or exists(
,0):
clickAll(
)
buyContract(
)
if not exists(
,0):
refreshPage()
switchApp("Social City on Facebook")
refreshPage()
cycle = 0
while True:
main()
cycle = cycle + 1
if cycle == 50 or exists(Pattern(
).similar(0.95),0):
refreshPage()
cycle=0
# gamebox.onChange(main)