commit 526fbc9ff86dd56a458dcb94991d33660e43a0b6 Author: Peter <peter@minskio.co.uk> Date: Fri, 23 Oct 2026 12:07:03 +0100 Initial commit Diffstat:
| A | alcher.sh | | | 32 | ++++++++++++++++++++++++++++++++ |
| A | cooker.sh | | | 77 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | decanter.sh | | | 49 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | empty-first-14.sh | | | 58 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | flaxer.sh | | | 82 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | functions.sh | | | 132 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | inv-1-to-2.sh | | | 39 | +++++++++++++++++++++++++++++++++++++++ |
| A | readme.md | | | 7 | +++++++ |
| A | reroller.sh | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
| A | runecrafter.sh | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | smelter.sh | | | 59 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | smither.sh | | | 76 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | ungrimy-herbs.sh | | | 68 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
13 files changed, 774 insertions(+), 0 deletions(-)
diff --git a/alcher.sh b/alcher.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +if [ -z "$1" ]; then + echo "Usage: $0 <number>" + echo + echo "Runs the script the specified number of times." + echo + echo "Example:" + echo " $0 44" + exit 1 +fi + +count=$1 + +startup + +# Count down +printf " - Starting script in 3 seconds...\n" +sleep 3 + +for ((i=count; i>0; i--)); do + printf '\r - Running script %d times' "$i" + left_click + msleep 250 450 + left_click + msleep 3200 3600 +done + +complete diff --git a/cooker.sh b/cooker.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# starting position. next to bank chest with inventory full of flax + +# variables +clay_oven=(1126 452) +bank_chest=(824 606) +food_position=(1019 405) + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +if [ -z "$1" ]; then + echo "Usage: $0 <number>" + echo + echo "Runs the script the specified number of times." + echo + echo "Example:" + echo " $0 44" + exit 1 +fi + +count=$1 + +startup + +# Count down +printf " - Starting script in 3 seconds...\n" +sleep 3 + # north orient screen + move_mouse 1713 14 27 18 + msleep 100 200 + left_click + +for ((i=count; i>0; i--)); do + printf '\r - Running script %d times' "$i" + # inventory 1 to wheel + move_mouse 1750 800 16 10 # inventory slot 1 + msleep 150 250 + left_click + msleep 150 250 + move_mouse "${clay_oven[@]}" # wheel location + msleep 150 250 + left_click # click on wheel + msleep 6000 7000 # run to oven + move_mouse 257 996 + msleep 150 250 + right_click # right click bow string in pane + msleep 100 200 + move_mouse 249 1057 + msleep 150 250 + left_click + msleep 64000 66000 # cooking food + move_mouse "${bank_chest[@]}" # bank chest + msleep 150 250 + left_click + msleep 6000 7000 # run to bank + move_mouse 1072 605 29 28 + msleep 250 350 + left_click # deposit all strings in bank + msleep 250 350 + move_mouse "${food_position[@]}" + msleep 250 350 + right_click + msleep 250 350 + move_mouse -r 0 81 + msleep 250 350 + left_click # withdraw all flax + msleep 450 550 + move_mouse 1085 323 16 16 + msleep 150 250 + left_click # close bank + + +done + +complete diff --git a/decanter.sh b/decanter.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +function use_potion_1() { + potion_1=$(current_mouse) + right_click + msleep 150 250 + move_mouse -r 0 48 && msleep 150 250 && left_click # use potion 1 +} + +function run_action() { + printf ' - Decanting potion row...\n' + use_potion_1 + move_mouse ${potion_1/,/} && move_mouse -r 44 0 + msleep 100 200 && left_click # ...on potion 2 + move_mouse ${potion_1/,/} # restore + use_potion_1 + move_mouse ${potion_1/,/} && move_mouse -r 81 0 + msleep 100 200 && left_click # ...on potion 3 + move_mouse ${potion_1/,/} # restore + use_potion_1 + move_mouse ${potion_1/,/} && move_mouse -r 127 0 + msleep 100 200 && left_click # ...on potion 4 + move_mouse ${potion_1/,/} # restore + move_mouse -r 0 35 # move down a row +} + +CLEANUP_DONE=0 +function on_exit() { + if [[ "$CLEANUP_DONE" -eq 1 ]]; then + return + fi + CLEANUP_DONE=1 + + cleanup + exit 0 +} + +startup + +printf ' - Press F11 to decant row of potions\n' + +while true; do + if read -r _line < "$pipe"; then + run_action + fi +done diff --git a/empty-first-14.sh b/empty-first-14.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + + +function move_mouse_steps() { + # Usage: move_mouse_steps target_x target_y [steps] [delay_ms] + # Walks the cursor from its current position to the target in many + # small increments instead of one instant warp, so apps/games that + # only refresh hover/hit-test state on continuous motion actually + # see the cursor "pass over" everything in between. + if [[ $# -lt 2 ]]; then + echo "Usage: move_mouse_steps target_x target_y [steps] [delay_ms]" >&2 + return 1 + fi + + local target_x="$1" + local target_y="$2" + local steps="${3:-20}" + local delay_ms="${4:-4}" + + local cur cur_x cur_y + cur="$(current_mouse | tr -d ' ')" + cur_x="${cur%%,*}" + cur_y="${cur##*,}" + + local i step_x step_y + for ((i = 1; i <= steps; i++)); do + step_x=$(( cur_x + (target_x - cur_x) * i / steps )) + step_y=$(( cur_y + (target_y - cur_y) * i / steps )) + hctl dispatch "hl.dsp.cursor.move({ x = $step_x, y = $step_y })" + msleep "$delay_ms" + done +} + + + +# potion 1 +move_mouse_steps 1756 808 +msleep 40 75 +right_click +msleep 50 100 +move_mouse_steps 1756 848 +left_click +msleep 100 250 + +exit + +# potion 2 +move_mouse 1797 802 +msleep 40 75 +right_click +msleep 50 100 +move_mouse 1795 849 +msleep 50 100 +left_click +msleep 100 250 diff --git a/flaxer.sh b/flaxer.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +# starting position. next to bank chest with inventory full of flax + +# variables +spinning_wheel=(1694 664) +bank_chest=(302 429) +flax_position=(1019 405) + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +if [ -z "$1" ]; then + echo "Usage: $0 <number>" + echo + echo "Runs the script the specified number of times." + echo + echo "Example:" + echo " $0 44" + exit 1 +fi + +count=$1 + +startup + +# Count down +printf " - Starting script in 3 seconds...\n" +sleep 3 + # north orient screen + move_mouse 1713 14 27 18 + msleep 100 200 + left_click + # rotate screen + ydotool key 105:1 + msleep 320 + ydotool key 105:0 + # zoom out screen ..? ydotool key 103:1 + +for ((i=count; i>0; i--)); do + printf '\r - Running script %d times' "$i" + # inventory 1 to wheel + move_mouse 1750 800 16 10 # inventory slot 1 + msleep 150 250 + left_click + msleep 150 250 + move_mouse "${spinning_wheel[@]}" # wheel location + msleep 150 250 + left_click # click on wheel + msleep 9000 10000 # run to wheel + move_mouse 257 996 + msleep 150 250 + right_click # right click bow string in pane + msleep 100 200 + move_mouse 249 1057 + msleep 150 250 + left_click + msleep 52000 58000 # making bowstrings + move_mouse "${bank_chest[@]}" # bank chest + msleep 150 250 + left_click + msleep 9000 10000 # run to bank + move_mouse 1072 605 29 28 + msleep 250 350 + left_click # deposit all strings in bank + msleep 250 350 + move_mouse "${flax_position[@]}" + msleep 250 350 + right_click + msleep 250 350 + move_mouse -r 0 81 + msleep 250 350 + left_click # withdraw all flax + msleep 450 550 + move_mouse 1085 323 16 16 + msleep 150 250 + left_click # close bank + + +done + +complete diff --git a/functions.sh b/functions.sh @@ -0,0 +1,132 @@ +#!/usr/bin/env bash + +# all functions assume you're running in fullscreen on a 1920x1080 monitor + +# currentpos: hyprctl cursorpos +# currentpos: slurp + +set -uo pipefail + +function msleep() { + local ms + case "$#" in + 1) ms=$1 ;; + 2) ms=$(shuf -i "$1-$2" -n 1) ;; + *) return 1 ;; + esac + sleep "$(printf '%s' "$ms" | awk '{printf "%.3f", $1 / 1000}')" + read -r -t "$((ms / 1000)).$((ms % 1000))" <<< "" +} + +function hctl() { + hyprctl "$@" >/dev/null +} + +function fullscreen() { + target_class="org-eclipse-jdt-internal-jarinjarloader-JarRsrcLoader" + hctl dispatch "hl.dsp.window.fullscreen({ window = 'class:$target_class', action = 'set' })" +} + +function left_click() { + msleep 100 200 + hctl dispatch 'hl.dsp.send_key_state({ mods = 0, key = "mouse:272", state = "down" })' >/dev/null + hctl dispatch 'hl.dsp.send_key_state({ mods = 0, key = "mouse:272", state = "up" })' >/dev/null +} + +function right_click() { + msleep 100 200 + hctl dispatch 'hl.dsp.send_key_state({ mods = 0, key = "mouse:273", state = "down" })' >/dev/null + hctl dispatch 'hl.dsp.send_key_state({ mods = 0, key = "mouse:273", state = "up" })' >/dev/null + msleep 100 200 +} + +function current_mouse() { + hyprctl cursorpos +} + +function move_mouse() { + # debug line: printf 'args(%d):' "$#"; printf ' [%q]' "$@"; printf '\n' >&2 + local relative=0 + if [[ "${1:-}" == "-r" ]]; then + relative=1 + shift + fi + + local x y width height + case "$#" in + 2) + x="$1" + y="$2" + ;; + + 4) + x="$1" + y="$2" + width="$3" + height="$4" + + # arithmetic instead of shuf so negative relative offsets work + x=$((x + RANDOM % (width + 1))) + y=$((y + RANDOM % (height + 1))) + ;; + + *) + echo "Usage: move_mouse [-r] x y [width height]" >&2 + return 1 + ;; + esac + + if ((relative)); then + local cx cy + # hyprctl cursorpos prints "150, 150" + IFS=', ' read -r cx cy < <(hyprctl cursorpos) + x=$((cx + x)) + y=$((cy + y)) + fi + + ydotool mousemove -a -x "$x" -y "$y" +} + +function cleanup() { + hctl eval 'hl.unbind("SUPER + F12")' >/dev/null + hctl eval 'hl.unbind("F11")' 2>/dev/null + rm -f "$pipe" + # restore cursor hiding + hctl eval 'hl.config({ ["cursor.inactive_timeout"] = 3 })' + + # stop ydotoold if we started it + if [[ -n "${YDOTOOLD_PID:-}" ]]; then + kill "$YDOTOOLD_PID" 2>/dev/null + wait "$YDOTOOLD_PID" 2>/dev/null + fi +} + +function startup() { + # cleanup on term or int + trap 'cleanup; exit 0' TERM INT + # pipe setup + pipe="/tmp/rsps.pipe" + mkfifo "$pipe" + + # start ydotoold in background (skip if already running) + if pgrep -x ydotoold >/dev/null; then + printf ' - ydotoold already running, skipping start\n' + YDOTOOLD_PID="" + else + ydotoold >/dev/null 2>&1 & + YDOTOOLD_PID=$! + sleep 0.3 + fi + # fullscreen client + fullscreen + # disable mouse cursor hiding + hctl eval 'hl.config({ ["cursor.inactive_timeout"] = 0 })' + printf 'Press Super+F12 to quit.\n' + hctl eval "hl.bind(\"SUPER + F12\", hl.dsp.exec_cmd(\"kill $BASHPID\"))" >/dev/null + hctl eval "hl.bind(\"F11\", hl.dsp.exec_cmd(\"echo go > $pipe\"))" +} + +function complete() { + printf '\nFinished.\n' + cleanup +} diff --git a/inv-1-to-2.sh b/inv-1-to-2.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# variables +inventory_1=(1745 793 22 20) +inventory_2=(1787 796 24 14) + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +if [ -z "$1" ]; then + echo "Usage: $0 <number>" + echo + echo "Runs the script the specified number of times." + echo + echo "Example:" + echo " $0 44" + exit 1 +fi + +count=$1 + +startup + +# Count down +printf " - Starting script in 3 seconds...\n" +sleep 3 + +for ((i=count; i>0; i--)); do + printf '\r - Running script %d times' "$i" + move_mouse "${inventory_1[@]}" # inventory 1 + msleep 100 150 + left_click + msleep 100 150 + move_mouse "${inventory_2[@]}" # inventory 2 + msleep 100 150 + left_click +done + +complete diff --git a/readme.md b/readme.md @@ -0,0 +1,7 @@ + +## Requirements +* `hyprland` 0.55 and above +* `ydotool` +* `bash` + +* You must also disable mouse acceleration in Hyprland to have ydotool accurately move your mouse. diff --git a/reroller.sh b/reroller.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +function run_action() { + printf ' - Re-rolling slayer task...\n' + slayer_master=$(current_mouse) + left_click + msleep 250 350 + move_mouse 234 1025 143 6 + msleep 650 850 + left_click + msleep 250 350 + move_mouse 171 961 179 9 + msleep 250 350 + left_click + move_mouse ${slayer_master/,/} +} + +CLEANUP_DONE=0 +function on_exit() { + if [[ "$CLEANUP_DONE" -eq 1 ]]; then + return + fi + CLEANUP_DONE=1 + + cleanup + exit 0 +} + +startup + +printf ' - Press F11 to re-roll slayer task\n' + +while true; do + if read -r _line < "$pipe"; then + run_action + fi +done diff --git a/runecrafter.sh b/runecrafter.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +pess_location=(720 402 17 17) + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +function run_action() { + printf ' - Filling inventory...\n' + bank_chest=$(current_mouse) + left_click # click check + msleep 250 350 + move_mouse 1875 795 16 16 + msleep 150 200 + right_click + move_mouse -r 0 75 + msleep 150 200 + left_click && msleep 150 250 # deposit all + move_mouse "${pess_location[@]}" && msleep 150 250 + right_click && msleep 150 200 # pess in bank + move_mouse -r 0 75 && msleep 150 200 && left_click # withdraw all + move_mouse 1084 323 17 17 && msleep 150 250 && left_click # close bank + msleep 250 300 + move_mouse 1746 794 18 18 && msleep 150 200 && left_click # fill bag 1 + move_mouse 1792 798 18 18 && msleep 150 200 && left_click # fill bag 2 + move_mouse 1834 794 18 18 && msleep 150 200 && left_click # fill bag 3 + move_mouse ${bank_chest/,/} && msleep 150 200 && left_click # open bank + move_mouse "${pess_location[@]}" && msleep 150 250 + right_click && msleep 150 250 # pess in bank + right_click && msleep 150 200 + move_mouse -r 0 75 && msleep 150 200 + msleep 150 250 + left_click +} + +CLEANUP_DONE=0 +function on_exit() { + if [[ "$CLEANUP_DONE" -eq 1 ]]; then + return + fi + CLEANUP_DONE=1 + + cleanup + exit 0 +} + +startup + +printf ' - Press F11 to re-roll slayer task\n' + +while true; do + if read -r _line < "$pipe"; then + run_action + fi +done diff --git a/smelter.sh b/smelter.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# variables +mith_ore=(1018 516) +coal=(971 518) +flax_position=(1017 408) + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +if [ -z "$1" ]; then + echo "Usage: $0 <number>" + echo + echo "Runs the script the specified number of times." + echo + echo "Example:" + echo " $0 44" + exit 1 +fi + +count=$1 + +startup + +# variables + + +# Count down +printf " - Starting script in 3 seconds...\n" +sleep 3 + +for ((i=count; i>0; i--)); do + printf '\r - Running script %d times' "$i" + # deposit inventory + move_mouse 1070 605 30 27 && left_click + # withdraw 5x mith + move_mouse "${mith_ore[@]}" && right_click + move_mouse -r 0 46 && left_click + # withdraw allx coal + move_mouse "${coal[@]}" && right_click + move_mouse -r 0 74 && left_click + # close bank + move_mouse 1084 324 17 13 && left_click + # click on furnace + move_mouse 173 631 && left_click + msleep 6000 7000 + # right click mith and make 5 + move_mouse 346 990 && right_click + msleep 250 500 + move_mouse -r 0 32 && left_click + # smelting + msleep 17500 18500 + # bank + move_mouse 1665 384 && right_click + move_mouse -r 0 48 && left_click + msleep 6000 7000 +done + +complete diff --git a/smither.sh b/smither.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# variables +bar_bank=(968 480) +anvil_position_bank=(1143 941) +anvil_position_stood=(968 574) +banker_position=(891 304) + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +if [ -z "$1" ]; then + echo "Usage: $0 <number>" + echo + echo "Runs the script the specified number of times." + echo + echo "Example:" + echo " $0 44" + exit 1 +fi + +count=$1 + +startup + +# variables + +make_10x_bolts() { + msleep 550 700 + move_mouse 1052 375 + right_click + msleep 250 500 + move_mouse -r 0 57 + left_click + } + +# Count down +printf " - Starting script in 3 seconds...\n" +sleep 3 + +for ((i=count; i>0; i--)); do + printf '\r - Running script %d times' "$i" + # withdraw all mith bars + move_mouse "${bar_bank[@]}" && right_click + msleep 250 400 + move_mouse -r 0 75 && left_click + # close bank + move_mouse 1085 322 16 16 && msleep 100 200 && left_click + msleep 250 500 + # inventory grid 2, click on anvil + move_mouse 1794 793 16 16 && left_click + move_mouse 1330 589 && left_click + # run to anvil + msleep 3500 4500 + # make 10x bolts + make_10x_bolts && msleep 32500 34500 + # inventory grid 12, click on anvil + move_mouse 1877 869 15 15 && left_click + msleep 250 500 + move_mouse "${anvil_position_stood[@]}" && left_click + # make 10x bolts + make_10x_bolts && msleep 32500 34500 + # inventory grid 24, click on anvil + move_mouse 1790 976 18 18 && left_click + msleep 250 500 + move_mouse "${anvil_position_stood[@]}" && left_click + # make final 10x bolts + make_10x_bolts && msleep 14000 15000 + # run to banker + move_mouse "${banker_position[@]}" && right_click + msleep 250 500 + move_mouse -r 0 45 && left_click + msleep 5500 7500 +done + +complete diff --git a/ungrimy-herbs.sh b/ungrimy-herbs.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# include functions +source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" + +grid_click() { + local start_x=1751 + local start_y=794 + local col_spacing=42 + local row_spacing=36 + + local cols=4 + local rows=7 + + # 0 = row-major, 1 = column-major + local order=$((RANDOM % 2)) + + if (( order == 0 )); then + # Row by row: 1,2,3,4,5,6... + for ((row = 0; row < rows; row++)); do + for ((col = 0; col < cols; col++)); do + local x=$((start_x + col * col_spacing)) + local y=$((start_y + row * row_spacing)) + + move_mouse "$x" "$y" 16 16 + msleep 100 200 && left_click && msleep 100 200 + done + done + else + # Column by column: 1,5,9,13... + for ((col = 0; col < cols; col++)); do + for ((row = 0; row < rows; row++)); do + local x=$((start_x + col * col_spacing)) + local y=$((start_y + row * row_spacing)) + + move_mouse "$x" "$y" 16 16 + msleep 100 200 && left_click && msleep 100 200 + done + done + fi +} + + +function run_action() { + printf ' - Cleaning every herb...\n' + grid_click +} + +CLEANUP_DONE=0 +function on_exit() { + if [[ "$CLEANUP_DONE" -eq 1 ]]; then + return + fi + CLEANUP_DONE=1 + + cleanup + exit 0 +} + +startup + +printf ' - Press F11 to re-roll slayer task\n' + +while true; do + if read -r _line < "$pipe"; then + run_action + fi +done