Skip to content

Instantly share code, notes, and snippets.

@clux
Created December 31, 2015 12:58
Show Gist options
  • Save clux/ecfbd7cc44504af84066 to your computer and use it in GitHub Desktop.
Save clux/ecfbd7cc44504af84066 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# Export the main window:
XWINDOW=$(xdotool search --class Magicka)
# helpers
mousemove() {
xdotool mousemove --window $XWINDOW $1 $2
}
key() {
xdotool key --window $XWINDOW $1
}
hold() {
xdotool keydown --window $XWINDOW $1
}
release() {
xdotool keyup --window $XWINDOW $1
}
click() {
xdotool click --window $XWINDOW $1
}
# behaviour
focus() {
mousemove 1 1
click 1
}
res() {
key w
sleep 0.2
key a
sleep 0.2
key space
}
load_arcane() {
key s
sleep 0.6
key s
sleep 0.6
key s
sleep 0.6
key s
sleep 0.6
key s
}
aoe() {
hold "shift"
sleep 0.05
click 2
sleep 0.05
release "shift"
}
kill_friend() {
load_arcane
sleep 0.4
aoe
sleep 0.8
res
sleep 0.2
}
suicide() {
key a
key s
key f
sleep 0.25
click 2
sleep 0.25
}
focus
for i in {1..10000}; do
echo $i
suicide
done
@clux
Copy link
Author

clux commented Dec 31, 2015

Script tested to get the grind achievements in magicka 2. Mostly just for fun to see if we could do the same autohotkey magic that is common on windows. Turns out, even easier since it's just raw bash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment