rsps-scripts

Automation scripts for private servers
Log | Files | Refs

commit 36e3295df139dfcc3b17fd9c1d769562d67a9199
parent 3823c7d6c2d19c0a2730d9d0d0a97c6c9bb48f84
Author: Peter <peter@minskio.co.uk>
Date:   Tue,  3 Nov 2026 16:07:22 +0000

Working script now

Diffstat:
Mempty-first-14.sh | 100+++++++++++++++++++++++++++++++++++++++++++------------------------------------
1 file changed, 54 insertions(+), 46 deletions(-)

diff --git a/empty-first-14.sh b/empty-first-14.sh @@ -3,56 +3,64 @@ # include functions source "$(dirname "${BASH_SOURCE[0]}")/functions.sh" +function empty_potion() { + msleep 100 200 + right_click + msleep 200 250 + move_mouse -r 0 48 + msleep 100 200 + left_click +} -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 +function run_action() { + printf ' - Emptying 14 potions...\n' + move_mouse 1749 795 16 16 # 1 + empty_potion + move_mouse 1790 794 16 16 # 2 + empty_potion + move_mouse 1833 795 16 16 # 3 + empty_potion + move_mouse 1874 796 16 16 # 4 + empty_potion + move_mouse 1746 832 16 16 # 5 + empty_potion + move_mouse 1789 832 16 16 # 6 + empty_potion + move_mouse 1832 830 16 16 # 7 + empty_potion + move_mouse 1876 830 16 16 # 8 + empty_potion + move_mouse 1747 868 16 16 # 9 + empty_potion + move_mouse 1792 867 16 16 # 10 + empty_potion + move_mouse 1832 867 16 16 # 11 + empty_potion + move_mouse 1875 870 16 16 # 12 + empty_potion + move_mouse 1748 903 16 16 # 13 + empty_potion + move_mouse 1789 904 16 16 # 14 + empty_potion } +CLEANUP_DONE=0 +function on_exit() { + if [[ "$CLEANUP_DONE" -eq 1 ]]; then + return + fi + CLEANUP_DONE=1 + cleanup + exit 0 +} -# 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 +startup -exit +printf ' - Press F11 to empty first 14 potions\n' -# 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 +while true; do + if read -r _line < "$pipe"; then + run_action + fi +done