sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #56479
[Question #695203]: Random move
New question #695203 on Sikuli:
https://answers.launchpad.net/sikuli/+question/695203
Hello, I have a problem with code....
I make a farm bot for a game... and Im trying to make it little bit more random.
and my random move doesnt work... Its get stuck and doesnt move with screen
Can you help me please where I make a misstake?
Thanks for answer
this is my codeimport random
Settings.MouseMoveDelay=0.25
Z1 = Region(270,285,1235,544)
Z2 = Region(478,417,423,376)
Z3 = Region(195,219,1309,611)
for z in range (10):
for x in range (1000 ) :
rndtime = random.randrange(0,1000)
rndtime = rndtime/1000
if exists(Pattern("smrt.png").similar(0.90)):
click(Pattern("smrt.png").similar(0.90).targetOffset(-40,41),2)
click(Pattern("oprava.png").similar(0.90),2)
click("pomoc.png",2)
click("speedup.png",2)
while exists(Pattern("opravaspeedup.png"),2):
click(Pattern("opravaspeedup.png").similar(0.80).targetOffset(-225,-53),2)
wait(1+rndtime)
click(Pattern("oprava finish.png").similar(0.90).targetOffset(311,11),2)
wait(1+rndtime)
click(Pattern("poslat.png").similar(0.90).targetOffset(-18,-132),5)
click(Pattern("go.png").similar(0.90),5)
wait(Pattern("přílet.png").similar(0.90),3600)
z=z+1
else:
wait(0.1+rndtime)
if Z1.exists(Pattern("wing-1.png").similar(0.90)):
Z1.click(Pattern("wing-3.png").similar(0.90).targetOffset(-102,-3))
if exists("attack-1.png",2):
click(Pattern("attack-2.png").targetOffset(99,8),2)
wait(1+rndtime)
wait("battle.png", 55)
wait(6+rndtime)
x=x+1
else:
wait(3+rndtime)
type(Key.ESC)
wait(1+rndtime)
if exists("noyes.png",2):
click("no.png")
w = int(Z2.w * random.random())
h = int(Z2.h * random.random())
Z2.click(Location(w + Z2.x,h + Z2.y))
else:
wait(0.25+rndtime)
else:
wd = int(Z3.w * random.random())
hd = int(Z3.h * random.random())
wu = int(Z3.w * random.random())
hu = int(Z3.w * random.random())
Z3.mouseMove(Location(wd + Z3.x,hd + Z3.y))
mouseDown(Button.LEFT)
wait(0.5)
Z3.mouseMove(Location(wu + Z3.x,hu + Z3.y))
mouseUp(Button.LEFT)
Thanks for help
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.