← Back to team overview

sikuli-driver team mailing list archive

[Question #220602]: Start a loop from a specific point

 

New question #220602 on Sikuli:
https://answers.launchpad.net/sikuli/+question/220602

Hi everyone,

I'm playing roulette on a casino game and I want to create a while loop to place bets.

****the challenge:

Restart the script from the beginning (#point A) every time I win. 
Starting with bet 1 (img3) and chips are placed on a number (i.e. number 3)
--Round 1:
#3 win: restart the script from the beginning.
#3 lose: place another bet (bet 2=img4)
--Round 2:
#3 win: restart the script from the beginning.
#3 lose: place another bet (bet 3=img5)
--etc...
Before placing bets, there is a waiting time which ends when "img2" appears.
The script ends after bet 3 if #3 lose.

****the problem:

Seems like my script doesn't recognize the condition (img1) and place the same bet (bet 1) over and over again.

****the script:


While True:  #Point A
	if not exists(img1, 0):
		wait(img2, FOREVER)
		click(img3)
		continue
	else:
		if exists(img1, 0):
		wait(img2, FOREVER)
		click(img4)
		break
While True:  #Point B
	if not exists(img1, 0):
		wait(img2, FOREVER)
		click(img3)
		continue # Want to restart from point A, not point B
	else:
		if exists(img1, 0):
		wait(img2, FOREVER)
		click(img5)
		break

#etc….

Can you help me please?

Thank you!


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.