Xdotool to automate moves in Epiphany (Boulderdash Clone)
Reducing your delays seems like the obvious answer. The default is 12ms and you've boosted that to 100ms for your arrow presses, without explaining why.
And instead of using keydown
then keyup
and having to worry about delays and all that jazz, just use key
. This allows you to just chain keys together, like a boss:
xdotool key Down Down Down Right
If you find that's too quick, reintroduce your --delay
but start from 12 and work up until it works.
Related videos on Youtube
![somethis](https://i.stack.imgur.com/YZwet.jpg?s=256&g=1)
somethis
Just a regular Ubuntu/Linux user - so no Windows here :) I like jamming on my guitar. Looking forward to exchanging some experience here.
Updated on September 18, 2022Comments
-
somethis almost 2 years
I'm trying to automate critical moves in my favorite Boulderdash clone called "Epiphany" (available through Ubuntu Software Centre).
In the following example the character should move: 3x "Down Arrow" and 1x "Right Arrow".
Writing a script is pretty straightforward. Once launched it (1) sets focus to the game window and (2) sends the keystroke commands through Xdotool.
#!/bin/bash # set focus to epiphany xdotool search --onlyvisible --class epiphany windowactivate sleep 0.5 # move down one unit xdotool keydown --delay 100 Down Arrow; xdotool keyup --delay 12 Down Arrow # move down one unit xdotool keydown --delay 100 Down Arrow; xdotool keyup --delay 12 Down Arrow # move down one unit xdotool keydown --delay 100 Down Arrow; xdotool keyup --delay 12 Down Arrow # move right one unit xdotool keydown --delay 100 Right Arrow; xdotool keyup --delay 12 Right Arrow
But, this solution doesn't work consistently.
Sometimes the character only completes part of the move - e. g. only 2x "Down Arrow". At other times he moves too slow and is crushed by the diamond.
Are there any suggestions on how to solve this - preferrably using Xdotool?
Edit:
The straightforward commands like
xdotool key Down Arrow
- as suggested - don't work. The character in the game doesn't move at all. -
somethis over 10 yearsEpiphany doesn't recognize the standard keystrokes sent through
key
. For examplexdotool key Down Arrow
doesn't move the character at all. -
somethis over 10 yearsand Reintroducing
--delay
withkey
only delivers movement if very long delays are used around 200 milliseconds.