← Back to team overview

sikuli-driver team mailing list archive

[Bug 1788596] Re: Sikulix 1.1.3 exist() ignores region

 

Well this is a rather easy one and not a bug.

Be sure you have understood, how SikuliX finds images:
https://sikulix-2014.readthedocs.io/en/latest/basicinfo.html#sikulix-how-does-it-find-images-on-the-screen

In your case, the problem is not the region (this surely works), the
problem are your search images.

If you need similar(0.73) to get a match, then this means, that your image is rather bad (probably too much background around the key visual aspects of the image).
Find ops should come back with a match score of more than 0.8 even better 0.9.

So before doing such shortcuts, that silently may fail, like:
if l.exists("1535015573308.png", 0):
            type(Key.RIGHT)
        else:
            type(Key.LEFT)

You should add some debugging like highlight() to simply see what is
found - if anything.

look into the docs, to get more ideas about what you can do, to make
your scripts more robust.

If you are on Windows or Mac, you should upgrade to version 1.1.4

** Description changed:

- I recently tried to automate a couple of games and ran across a major
- issue of which I spent a good couple days searching for a fix but i've
- come up empty handed and so here I am hoping I can get it fixed here.
- 
  My issue is that r.exists() seems to ignore the region I've given it
  I've had this happen to me in multiple games so far but I'm going to use
  the most basic one to make it easier to possible try and fix.
  
  My code:
  l = Region(1009,579,116,51)
  
  r = Region(1223,576,109,53)
  
  while True:
  
          if l.exists("1535015573308.png", 0):
              type(Key.RIGHT)
          else:
              type(Key.LEFT)
  
          if r.exists (Pattern("1535015633109.png").similar(0.73), 0):
              type(Key.LEFT)
          else:
              type(Key.RIGHT)
- 
- what this is supposed to do is play a game called Timberman for me (the browser version) essentially the entire game is just you with a never ending tree in the middle of the screen and your goal is to chop it down...
- as you chop the tree down (with the left or right keys) branches come down on either the left or right side.
- 
- Your goal is to dodge them (by pressing the left or right key again
- note: the branches only move on key input) and continue to chop the tree
- down or else you will die and game over.
- 
- How I obtained this (Or attempted to rather) is by making two very small
- regions on the left or right exactly where the branches would be
- directly above you.
- 
- after that I just grabbed two pics of the tree branches and set it up so
- that if the tree branch exists above you... go to other side (by hitting
- the left or right key) and that's it.
- 
- My problem is that it seems to ignore the regions and just sees the
- branches way far up the tree and decides to go to the left or right and
- well, dies because a branch was lower on the other side and game over.
- 
- And again this isn't the only game or program I've experienced this with
- - this one is just the simplest one.
- 
- Sorry for the wall of text - I just wanted to really explain everything as best I could.
- I'm not sure if it's my code or an actual bug but any help would be really appreciated. Thanks!

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

Title:
  Sikulix 1.1.3 exist() ignores region

Status in Sikuli:
  Invalid

Bug description:
  My issue is that r.exists() seems to ignore the region I've given it
  I've had this happen to me in multiple games so far but I'm going to
  use the most basic one to make it easier to possible try and fix.

  My code:
  l = Region(1009,579,116,51)

  r = Region(1223,576,109,53)

  while True:

          if l.exists("1535015573308.png", 0):
              type(Key.RIGHT)
          else:
              type(Key.LEFT)

          if r.exists (Pattern("1535015633109.png").similar(0.73), 0):
              type(Key.LEFT)
          else:
              type(Key.RIGHT)

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


References