Friday, December 5, 2014

Clicker Heroes Automation

The game is all automation and clicking.  I got tired of all the clicking after the first hour.  So, I figured out how to batch fabricate clicks.  Then, I figured out that it helps if the use of skills is also automated.


#!/bin/bash

# Farm on, to jump quickly to the strongest creatures you can face (most gold)
xdotool mousemove 1045 496 click 1
# Energize (8)  (doubles the effect of the next skill)
xdotool mousemove 597 784 click 1
# Dark Ritual (6)  (The skill with the longest recharge time)
xdotool mousemove 597 690 click 1
# Reload (9)  (knock 1 hour off the recharge time for the last skill used)
xdotool mousemove 597 829 click 1

# Golden Clicks (5)
xdotool mousemove 597 642 click 1
# Super Clicks (7)
xdotool mousemove 597 733 click 1
# Clickstorm (1)
xdotool mousemove 597 469 click 1
# Powersurge (2)
xdotool mousemove 597 512 click 1
# Lucky Strikes (3)
xdotool mousemove 597 551 click 1
# Metal Detector (4)
xdotool mousemove 597 601 click 1

sleep .02
for thousands   in 0 1 2
do for hundreds in 0 1 2 3 4 5 6 7 8 9
  do for tens   in 0 1 2 3 4 5 6 7 8 9
    # Mouse to critter  (helps prevent accidental clicks on other things)
    do xdotool mousemove 800 640 click 1
      for ones in 0 1 2 3 4 5 6 7 8 9
      do xdotool click 1
        sleep .02
      done
    done
  done
done

Saturday, February 28, 2009

More Bash tricks

While trying to figure out how to pack several scripts of functionality into a single script to make it a bit more portable (and depending on filesystem, possibly more efficient), I came up with the following concept, which has probably been used in quite a few programs before for consolidation purposes.


case "$(basename $0)" in
"rip.tv.sh")
[tv-dvd rip procedure]
;;
"rip.movie.sh")
[movie-dvd procedure]
;;
"rip.trailer.sh")
[music video or trailer rip procedure]
;;
esac

Of course, in order to use this, you then have to symlink (or hard link, your choice) the alternate names to the script to the actual script.

Friday, February 27, 2009

HandBrakeCLI helper

In attempting to automate some things with HandBrake, I've started using bash wrappers to handle passing the proper sets of parameters for the type of encode desired.

One hiccup I've noticed is that some DVDs have their directories upper case, while others have them as lower case.
My solution, after doing some searching online for how to use the bash built-in tests is as follows.


#!/bin/bash
if [ -d "/media/dvd/VIDEO_TS" ]; then
  location="/media/dvd/VIDEO_TS";
else
  location="/media/dvd/video_ts";
fi
HandBrakeCLI -i $location -t 0