← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #141369]: Import storp working after identation change

 

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

    Status: Answered => Open

Danielo is still having a problem:
Ok, i will try to use less time for the exists sentences. You're right
that are some smaller areas than the main one, but for the main purpose
of the i need that whole area.

I've readed that sikuli have problems with images that are more text
than image. I have one case where one button is mainly text, i don't
know if this is important.  The current area for search that button is
(IMO) relatively small, and it takes more time to find it than the
entire script to run once or twice.

The secuence of exist have this purpose:
 Only the next image should be found if the first one doesn't exist. That are spells, and when you use one, it dissapears from the screen, and then the next spell shoud be used. But i will try your solution instead.

Here is the second script. The button called cerrar is what have
problems founding it, and cerr is the region where it should be founded.


from sikuli.Sikuli import *
reg = Region(6,28,1061,850)
poderes=Region(584,762,467,87)
cerr=Region(36,412,998,297)

bichos=[Picture,picture,picture,picture]#
turno=Pattern("1294957943970.png").similar(0.68)
garra="1294666099451.png"
bicho="1294667073611.png"
jalato=Pattern("Il.png").similar(0.91)
bendicion=Pattern("1294681487072.png").similar(0.84)
listo="5I.png"
pasar="4.png"
cerrar=Pattern("Cerrar.png").similar(0.96)
casilla=Pattern("1294669287674.png").similar(0.76)


def dale(obj):
	if reg.exists(obj,1):click(reg.getLastMatch())

def mata( ):
	sleep(4)	
	for bug in bichos:
		if reg.exists(bug,0):
			print "aparecio uno"
			sleep(7)
			click(reg.getLastMatch())
			sleep(4)
			if reg.exists(listo):
				luchar()
				break

def luchar():
	dale(listo)
	while reg.exists(pasar):
		if exists(jalato):
			click(getLastMatch())	
			dale(casilla)
		else:
			if exists(bendicion):
				click(getLastMatch())
				dale(turno)
			else:
				if exists(bicho):
					click(getLastMatch())
					dale(casilla)
				else:
					for b in bichos:
						if exists(b):
							target=getLastMatch()
							dale(garra)
							dale(target)
							mouseMove(Location(100,100))
							
										
		dale(pasar)
	exists(turno,7)
	print "*************************Batalla finalizada"
	cerr.exists(cerrar,FOREVER)
	click(cerr.getLastMatch())

I am using the tab and shift+tab for indent, and the problems appears despite of it.
Some important thing, I think it sould be in the next sikuli ide is the posibility to undo. Is very frustating to make a little mistake and have to rewrite it.

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