← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #237431]: Need help with regions and my macro

 

Question #237431 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/237431

    Status: Answered => Open

joshua grover is still having a problem:
RaiMan an Boomy both thank you for your adivce. I believe I have it set
up and ready to go although I'm now running into another sort of
problem. I'm used to using VB and creating loops that way , which from
reading your post on loops RaiMan Python doesn't work that way. So what
I'm wandering is this.

Here is the start of my macro:

Create Region #this is the region to look for the start button
Find (img) #this image is in set region of start button
click()

#/////////////WAIT TO ENTER BATTLE SEQUENCE/////////////
wait(15)
click()
wait(2)
click()
wait(2)
click()
wait(10)
#/////////////END ENTER BATTLE SEQUENCE/////////////


Here is my loop as it's setup now.

#////////////BEGIN BATTLE SEQUENCE/////////////////


while exists(img,0): #this image is of a area of the screen that is only present during battle

#////////////START OF LOOP/////////////////


	Create Region #this region sets the location of the 5 cards to look at

	if
        	find (img) #this image is in set region of cards
        	click ()
			Create Region #sets region to look for invoke button
			find (img) #this image is in set region for invoke button
			click()
	else if
		Create Region # this region sets the location of the 5 cards to look at
		find (img) #this is image is in set region of cards
		click()
			Create Region #sets region to look for invoke button
			find (img) #this image is in set region for invoke button
			click()
	else
		Create Region #this region is set for the auto battle button
		find (img) # this image is in the set region for autobattle
		click()
		wait (8) # 8 second wait
	
#////////////CHECK IMG TO SEE RESTART/END OF LOOP/////////////////
	if exists(img,1) #this image is of a area of the screen that is only present during battle

#////////////END OF BATTLE SEQUENCE/////////////////

wait(300) #wait time is added here to avoid unwanted use of resources

Create Region #this region sets the location to look for the GO button
find(img) #this image is in set region of GO button
click()


So that is what i have currently. I am wanting to after it checks if the image is there or not at the end of the loop to if it is still there then go back and repeat the process.
if the image is not there then i want it to go to the wait(300) part. After the final click() i want it to go to the very start of the macro.

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