sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #15693
[Question #219984]: Decrease for loop by one
New question #219984 on Sikuli:
https://answers.launchpad.net/sikuli/+question/219984
for x in range(0,10):
decimal_value = random.randint(1,12)
if myList.count(decimal_value) < 1:
egg = 'A%d.png' % (decimal_value)
egg = wait(egg)
click(egg.getCenter().offset(random.randint(-10,10), random.randint(-10,10)))
myList.append(decimal_value)
else:
print x
x-1 = x
print x
I made an array to check if the random integer already exists and then I send it to the else statement at which point I want to decrease x by 1 so that it doesn't count as one of the loops. In other languages this works but it just comes up with:
[log] CLICK on (683,317)
[log] CLICK on (570,307)
3
2
[log] CLICK on (178,427)
[log] CLICK on (341,439)
[log] CLICK on (581,474)
[log] CLICK on (682,489)
[log] CLICK on (568,378)
9
8
10
9
As if I hadn't subtracted one from x. Anyways I'm stuck.. any suggestions?
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.