This Bash script automates key presses in the Tibia game client on Linux systems using Wayland. It's designed to run discreetly in the background, sending customizable keystrokes at regular intervals without interfering with your workflow.
- Background Operation: Runs silently without stealing focus from other tasks.
- Customizable: Easily configure the keys and their intervals.
- Window Detection: Automatically locates and tracks the Tibia window, adapting to title changes.
- Fail-Safe: Gracefully exits if the Tibia window is closed or cannot be found.
- Lightweight: Uses only
xdotool
for minimal dependencies.
- xdotool: Simulates keyboard and mouse input. Install with:
sudo apt install xdotool
Clone the Repository:
git clone [https://github.com/Gruffyy/tibia-macro](https://github.com/Gruffyy/tibia-macro.git)
cd tibia-macro
chmod +x macro.sh
Open the Script:
Edit tibia_macro.sh in a text editor. Key Presses:
Modify the key_presses array to define your desired key presses and intervals (in seconds):
key_presses=(
"1 20" # Key "1" every 20 seconds
"2 450" # Key "2" every 450 seconds (7.5 minutes)
# Add more in the format: "key interval_in_seconds"
)
Focus Tibia: Launch the Tibia client and ensure it is in focus. Run in Background: Execute the script in the background.
./macro.sh &
Stop:
Find the Process ID (PID):
ps aux | grep macro
Terminate:
kill <PID>
Window Not Found: If the script fails to find the Tibia window, double-check the window class ("Tibia") in the get_window_id function. If you have multiple Tibia windows, make sure to focus the correct window before running the script. Wayland Compatibility: This script is specifically designed for Wayland. If you are using an X11 window manager, focus stealing could occur and you might need to adjust the window focus mechanism.
Use this script at your own peril! I've no clue if battle-eye detects it.
Contributions are welcome! Please fork the repository and submit pull requests with your improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
Let me know if you need any further adjustments or have more questions!