rsps-scripts

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

decanter.sh (1047B)


      1 #!/usr/bin/env bash
      2 
      3 # include functions
      4 source "$(dirname "${BASH_SOURCE[0]}")/functions.sh"
      5 
      6 function use_potion_1() {
      7 	potion_1=$(current_mouse)
      8 	right_click
      9 	msleep 150 250
     10 	move_mouse -r 0 48 && msleep 150 250 && left_click # use potion 1
     11 }
     12 
     13 function run_action() {
     14 	printf ' - Decanting potion row...\n'
     15 	use_potion_1
     16 	move_mouse ${potion_1/,/} && move_mouse -r 44 0
     17 	msleep 100 200 && left_click # ...on potion 2
     18 	move_mouse ${potion_1/,/} # restore
     19 	use_potion_1
     20 	move_mouse ${potion_1/,/} && move_mouse -r 81 0
     21 	msleep 100 200 && left_click # ...on potion 3
     22 	move_mouse ${potion_1/,/} # restore
     23 	use_potion_1
     24 	move_mouse ${potion_1/,/} && move_mouse -r 127 0
     25 	msleep 100 200 && left_click # ...on potion 4
     26 	move_mouse ${potion_1/,/} # restore
     27 	move_mouse -r 0 35 # move down a row
     28 }
     29 
     30 CLEANUP_DONE=0
     31 function on_exit() {
     32 	if [[ "$CLEANUP_DONE" -eq 1 ]]; then
     33 		return
     34 	fi
     35 	CLEANUP_DONE=1
     36 
     37 	cleanup
     38 	exit 0
     39 }
     40 
     41 startup
     42 
     43 printf ' - Press F11 to decant row of potions\n'
     44 
     45 while true; do
     46 	if read -r _line < "$pipe"; then
     47 		run_action
     48 	fi
     49 done