← Back to team overview

sikuli-driver team mailing list archive

[Bug 1520861] [NEW] not correct work of operator IF

 

Public bug reported:

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)

** Affects: sikuli
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1520861

Title:
  not correct work of operator IF

Status in Sikuli:
  New

Bug description:
  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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1520861/+subscriptions


Follow ups