← Back to team overview

sikuli-driver team mailing list archive

[Question #276029]: not correct work of operator IF

 

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

v.1.1.1   win10 x64

in this line (    if ((checkdock()==1) and (checkenemy()==0)):     ) IF work as While. Doing only checkdock() and not trying  to checkenemy() while checkdock()!=1

code:

def checkdock():
    if (stationreg.inside().exists(undock,0.5)):
        docked=1
        print "в доке"
    else:
        docked=0
        print "не в доке"
    return docked

def checkenemy():
    if ((local.inside().exists(vrag1,0.5)) or( local.inside().exists(vrag2,0.5)) or (local.inside().exists(vrag3,0.5))):
        enemy=1
        print "есть вражина"
    else:
        enemy=0
        print "всё чисто"
    return enemy


while True:
    if ((checkdock()==1) and (checkenemy()==0)):
        print "ща андокнусь"
        stationreg.inside().click(undock)
        sleep (5)
	while (checkenemy() == 0):
		keyDown(Key.ALT)
		type("p")
		keyUp(Key.ALT)
		sleep (15)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.