Automatic game button clicker using Python and image recognition technology.
- ✅ Automatic Image Recognition - OpenCV template matching to locate buttons
- ✅ Smart Retry Mechanism - Auto-stop after 3 consecutive failures
- ✅ Two-Step Workflow - Spin button → Wait 5s → Confirm button
- ✅ Configurable Click Rounds - Default 50, customizable via command line
- ✅ Isolated Conda Environment - No dependency conflicts
- ✅ Detailed Logging - Records time, position, and button type for each click
Each complete round consists of 3 steps:
- Step 1: Click spin button (button_1.png or button_2.png)
- Step 2: Wait 5 seconds
- Step 3: Click confirm button (button_3.png)
After completing a round, wait 5 seconds (configurable), then start the next round.
- Conda (Anaconda or Miniconda) - Assumed to be installed
Windows:
# Run setup script to create conda environment
set_up.batLinux/Mac:
# Make scripts executable
chmod +x set_up.sh run.sh
# Run setup script
./set_up.shThis will:
- Create an isolated conda environment named
game_clicker(Python 3.11) - Install all required dependencies (OpenCV, PyAutoGUI, Pillow, NumPy)
- Configure the environment for running the auto-clicker
- Open the game interface and ensure buttons are visible
- Use screenshot tool (Win + Shift + S) to capture button images
- Save images to
images/directory:button_1.png- First spin button (priority match)button_2.png- Second spin button (alternative)button_3.png- Confirm button (appears after spinning)
Screenshot Tips:
- Capture only the button itself, avoid excessive background
- Save as PNG format for clarity
- Use actual button size
Windows:
# Use default settings (50 rounds)
run.bat
# Custom number of rounds
run.bat --max-clicks 100
# Test mode (10 rounds)
run.bat -n 10Linux/Mac:
# Use default settings
./run.sh
# Custom number of rounds
./run.sh --max-clicks 100
# Test mode
./run.sh -n 10python auto_clicker.py # Default (50 rounds)
python auto_clicker.py --max-clicks 100 # 100 rounds
python auto_clicker.py -n 10 # 10 rounds (testing)
python auto_clicker.py --debug # Enable debug loggingNote: The conda environment
game_clickerwill be automatically activated when using run.bat or run.sh
Main configuration in config.py:
| Setting | Default | Description |
|---|---|---|
CLICK_INTERVAL |
5 | Interval between rounds (seconds) |
STEP_WAIT_TIME |
5 | Wait time between Step 1 and Step 3 (seconds) |
DEFAULT_MAX_CLICKS |
50 | Default maximum rounds |
MAX_RETRIES |
3 | Maximum consecutive retries before stopping |
CONFIDENCE |
0.8 | Image matching confidence threshold (0.0-1.0) |
============================================================
Starting auto-clicker - Max rounds: 50
Workflow: Spin → Wait 5s → Confirm → Wait 5s
Will stop after 3 consecutive failures
============================================================
Starting in 3 seconds...
[Round 1/50] Step 1: Looking for spin button...
✓ Click button1 - Position: (800, 450)
Step 2: Waiting 5 seconds...
Step 3: Looking for confirm button...
✓ Click button3 - Position: (640, 360)
✓ Round 1 completed successfully
Waiting 5 seconds before next round...
[Round 2/50] Step 1: Looking for spin button...
...
============================================================
Execution completed! Total rounds: 50
============================================================
If you see "Missing button image files" error:
- Check that
images/directory contains all 3 PNG files:button_1.pngbutton_2.pngbutton_3.png
- Verify images are in PNG format
- See images/README.txt for detailed instructions
If "Failed to find button" error occurs:
- Check game window - Ensure game is open and buttons are visible
- Verify screenshots - Re-capture button images matching current interface
- Screen resolution - Ensure resolution matches when screenshots were taken
- Adjust confidence - Lower
CONFIDENCEvalue in config.py (e.g., 0.7)
Enable detailed matching information:
python auto_clicker.py --debugIf conda environment fails to activate:
# Manually activate environment
conda activate game_clicker
# Re-run setup if needed
set_up.bat # Windows
./set_up.sh # Linux/Mac- Python 3.11 (via Conda)
- OpenCV - Image processing and template matching
- PyAutoGUI - Mouse control and clicking
- Pillow - Screen capture
- NumPy - Numerical computing
game/
├── auto_clicker.py # Main program
├── config.py # Configuration file
├── requirements.txt # Python dependencies
├── README.md # Documentation
├── set_up.bat # Windows setup script
├── set_up.sh # Linux/Mac setup script
├── run.bat # Windows run script
├── run.sh # Linux/Mac run script
└── images/ # Button image directory
├── README.txt # Image instructions
├── button_1.png # First spin button template
├── button_2.png # Second spin button template
└── button_3.png # Confirm button template
- Game window must remain visible (do not minimize)
- Do not change screen resolution during execution
- Keep button positions consistent
- Must have Conda installed (Anaconda or Miniconda)
- Recommended: Test with
-n 10first before full run
# Activate environment manually (if needed)
conda activate game_clicker
# Deactivate environment
conda deactivate
# Remove environment (if needed)
conda env remove -n game_clicker
# Recreate environment
set_up.bat # or ./set_up.shMIT License
- ✨ Two-step workflow: Spin → Wait → Confirm
- ✨ Conda environment support
- ✅ Added button_3.png for confirm button
- ✅ Updated all documentation to English
- ✅ Simplified setup scripts (assumes conda installed)
- ✨ Initial release
- ✅ Dual button template matching
- ✅ Smart retry mechanism
- ✅ Configurable click rounds