sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #39656
Re: [Question #321908]: help with else
Question #321908 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/321908
Description changed to:
Hello. I am new to Sikuli and spent the last couple weeks reading
questions, watching videos and trying out many commands. I now have a
script (bot) I made for a flash game that I am happy with (I'm sure it
looks really crude to an experienced coder). What I haven't been able
to figure out is the "else" part. This will do everything I want it to
except I'd like to set it to click an image and, if that one isn't
available, go to a different one. This is what I have made so far:
setFindFailedResponse(SKIP)
while True:
click(Pattern("1470112829847.png").similar(0.90).targetOffset(-207,3))
click(Pattern("1470112829847.png").similar(0.90).targetOffset(-136,39))
click(Pattern("1470112829847.png").similar(0.90).targetOffset(-74,81))
click(Pattern("1470112829847.png").similar(0.90).targetOffset(-10,123))
click(Pattern("1470112829847.png").similar(0.90).targetOffset(68,150))
click(Pattern("1470099385638.png").similar(0.50), 1)
click(Pattern("1470099385638.png").similar(0.50), 1)
click(Pattern("1470099385638.png").similar(0.50), 1)
click(Pattern("1470099385638.png").similar(0.50), 1)
click(Pattern("1470141710780.png").targetOffset(-75,82))
if exists("1470141893102.png"):
click("1470141893102.png")
click(Pattern("1470193668517.png").similar(0.80).targetOffset(-1,37))
click(Pattern("1470142033137.png").similar(0.90))
click(Pattern("1470141710780.png").targetOffset(-79,185))
if exists("1470141893102.png"):
click("1470141893102.png")
click(Pattern("1470193668517.png").similar(0.80).targetOffset(-1,37))
click(Pattern("1470142033137.png").similar(0.90))
click(Pattern("1470141710780.png").targetOffset(-77,280))
if exists("1470141893102.png"):
click("1470141893102.png")
click(Pattern("1470193668517.png").similar(0.80).targetOffset(-1,37))
click(Pattern("1470142033137.png").similar(0.90))
if exists(Pattern("1470113950787.png").similar(0.90).targetOffset(1,87), 0):
doubleClick(Pattern("1470113950787.png").similar(0.90).targetOffset(1,87), 0)
click(Pattern("1470114166301.png").similar(0.90), 0)
click(Pattern("1470114252503.png").similar(0.90), 0)
if exists(Pattern("1470114320553.png").similar(0.90).targetOffset(4,81), 0):
doubleClick(Pattern("1470114320553.png").similar(0.90).targetOffset(4,81), 0)
click(Pattern("1470114166301.png").similar(0.90), 0)
click(Pattern("1470114418489.png").similar(0.90), 0)
The step I'd like to edit and so far haven't been able to work I'm
trying to do like this;
click(Pattern("1470141710780.png").targetOffset(-77,280))
if exists("1470141893102.png"):
click("1470141893102.png")
click(Pattern("1470193668517.png").similar(0.80).targetOffset(-1,37))
click(Pattern("1470142033137.png").similar(0.90))
else:
click(new image)
click(new image)
click(new image)
Every edit I've tried to accomplish this creates different errors no
matter what I've tried. Can anyone help me with what I'm doing wrong.
Thank you!!
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.