#πŸ”’ Debugging Template Matching in a Python Bot for Call of Dragons Emulator Automation

12 messages Β· Page 1 of 1 (latest)

bitter gulch
#

❌ Problem Summary
The script runs without crashing and takes emulator screenshots successfully. However, no UI buttons are detected, so the bot performs no actions and keeps looping.

⚠️ Console Output
text
KopiΓ«ren
Bewerken
[πŸ”] Geen match voor template: close_btn.png
[πŸ”] Geen match voor template: collect.png
[πŸ”] Geen match voor template: heal_btn.png
[πŸ”] Geen match voor template: train_btn.png
[πŸ”] Geen match voor template: upgrade_btn.png
[πŸ”] Geen match voor template: enemy_icon.png
[-] No active tasks found.
This output indicates that every match_template() attempt fails β€” none of the templates match anything in the screenshot.

πŸ”Ž What Has Been Tried
All required button images have already been saved as .png files.

The filenames match the expected names in the script.

The script successfully loads screenshots from the emulator using ADB.

The template images are placed in the correct folder (templates).

Despite these steps, template matching still fails completely.

🚫 Possible Causes
Wrong cropping or scaling
The .png files may be cropped incorrectly or taken at a different screen resolution than the current emulator window. Even a small pixel mismatch can break template matching.

Transparency or compression issues
Even if the file extension is .png, the images might contain transparency, anti-aliasing, or low contrast, which affects detection.

Inconsistent emulator resolution or zoom
The current emulator display may differ from when the screenshots were taken (e.g., DPI, UI scaling, window size).

Template image too large or too complex
Overly large templates reduce precision. Templates should be tightly cropped around the unique shape of the button.

spiral tapirBOT
#

@bitter gulch

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

bitter gulch
grizzled mauve
spiral tapirBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

bitter gulch
#

!paste

#

@grizzled mauve

#

@grizzled mauve

spiral tapirBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.