play_and_capture
Automate Pyxel game testing by simulating keyboard/mouse input at specific frames and capturing screenshots to verify input-dependent logic without manual play.
Instructions
Play a game by sending simulated input and capture screenshots.
Simulates keyboard/mouse input at specific frames and captures screenshots at specified frame points. Use this to test input-dependent game logic (menus, movement, shooting) without manual play.
Args: script_path: Absolute path to the .py script to run. inputs: JSON array of input events. Each event: {"frame": N, "keys": ["KEY_SPACE", ...], "mouse_x": X, "mouse_y": Y} Keys are held from their frame until a later entry changes them. Default state: no keys pressed, mouse at (0,0). frames: Comma-separated frame numbers to capture screenshots (default: "1,30,60"). scale: Screenshot scale multiplier (default: 1). timeout: Maximum seconds to wait for the script (default: 30).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script_path | Yes | ||
| inputs | Yes | ||
| frames | No | 1,30,60 | |
| scale | No | ||
| timeout | No |