Matching Game - How to?

Asked by Steven Csukardi on 2018-10-28

Very new to Sikuli (and coding). Been trying to automate a matching game but I can't seem to get it working.

In a section on the window, arrows will appear around the center, up, down, left and right. They usually appear for a second and start getting quicker as you progress. I was trying to mess around with onAppear to try and match the right image to the right input. left should be Key.LEFT, for example.

I'm unsure how to individually identify which arrow is on the screen in quick fashion. Any examples would be very helpful!

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-10-31
Last query:
2018-10-31
Last reply:
2018-10-30
RaiMan (raimund-hocke) said : #1

can you post a screenshot somewhere in the net?

To make things fast, you have to restrict the search region to the area, where the arrows are expected to appear.

But even if you get it fast with the search, the problem will be to coordinate the searches and the key actions.

What is the benefit, if you automate this?

RaiMan (raimund-hocke) said : #2

Possible for me, to look at the game in the net?

Steven Csukardi (cornbutter12) said : #3

Unfortunately I don't have any screenshots and I cannot link the game as it's not on the net.

No benefit other than seeing if I could create the project and get it working.

My current code, I was able to restrict the section where the arrows point and onAppear was working when it detected any of those arrows. From there, I was lost on how to hit the up key if the arrow was on the upper location in that region, same for arrows respective to their location.

If there isn't an easy solution to this, than no worries! I was hoping there was an example I could see that would point me in the right direction.

Best RaiMan (raimund-hocke) said : #4

you have to press the key as the last action in the onAppear handler. see docs.

Carefully read the docs about the observe feature.

It is even faster, if you define a separate region for every arrow area (IMHO: 4 areas) and run the observe in background separate for every region.

Steven Csukardi (cornbutter12) said : #5

I'll read more up on the Observe feature, thank you.

Steven Csukardi (cornbutter12) said : #6

Thanks RaiMan, that solved my question.