Linux multibox game script
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

No, not asking for a cheat. Multiple accounts are permitted in many online games, with limits, and with some penalties, in some cases. (more info here http://isboxer.com/wiki/Multiboxing )

The specific game is 'The Infinte Black', produced by Spellbook, found at www.spellbook.com The game engine is developed by Unity, found at https://unity3d.com

Multiboxing has wide support on Windows, and some support on Mac - but alas, no one has developed anything for Linux.

Let it be known that I am not a scripter, and certainly not a guru among scripters. But, I have played around with xdotool, sikuli, and xautomation. To date, I have not produced a working script.

I have ten (maximum permitted) accounts on TIB. During combat, it takes time to move a mouse from one window to another, and to mouseclick the desired target. It takes seconds to do so, but game action, as might be expected, is measured in nanoseconds. Often times, the result is that I die.

To be specific, I need a script which will accept a hot key prompt, find the mouse location within the active window, then pass that location to each of the other account windows, clicking the mouse on that same target. Ideally, this would all happen in less than a second, although the game server will automatically delay some of those clicks. (that is a penalty for having more than one account - actions are slowed down a little bit, but not nearly so much as manually clicking in each window)

Bounty set at $50 for "best" solution - offering $25 tip for alternative methods that work.

awarded to CyteBode

Crowdsource coding tasks.

1 Solution

Winning solution

Requirements

  • xdotool
  • xbindkeys

The script

Create a file name tib_script.sh in your home directory and copy paste the following into it:

#!/bin/bash

GAME_NAME="The Infinite Black"
SLEEP=.1

# Get the mouse location
eval $(xdotool getmouselocation --shell)

# Make sure that we have a window matching the name of the game
window_name=$(xdotool getwindowname $WINDOW)
if [ "$window_name" != "$GAME_NAME" ]
then
    exit
fi

GLOBAL_X=$X
GLOBAL_Y=$Y

# Figure out the local coordinates of the cursor
xdotool mousemove --window $WINDOW 0 0
eval $(xdotool getmouselocation --shell)
LOCAL_X=$(($GLOBAL_X - $X))
LOCAL_Y=$(($GLOBAL_Y - $Y))

# Send the click to all the windows matching the name of the game
xdotool search --name "$GAME_NAME" | while read -r window ; do
    xdotool windowactivate --sync $window
    xdotool mousemove --window $window $LOCAL_X $LOCAL_Y
    sleep $SLEEP
    xdotool click --clearmodifiers 1
    sleep $SLEEP
done

The script assumes that the resolution of each window is the same.

You will likely be able to reduce the value of the SLEEP variable, perhaps down to .02. I needed to make it that high in order to make the script work reliably in my Linux VM.

xbindkeys configuration

Create a file named .xbindkeysrc in your home directory and copy paste the following into it:

"bash ~/tib_script.sh"
    shift + c

This will run the script whenever Shift + C is pressed. You can change the hotkey to whatever you want.

I noticed that an orange circle would pop up in the main menu of the game whenever either Control or Alt were pressed, so I figured it'd be best to avoid those modifier keys.

To run xbindkeys, execute xbindkeys & in a terminal. To terminate it, execute killall xbindkeys.

You, Sir, are pretty awesome. I beat my head on this little thing many hours, over several days. Your solution works. I ran it first as you submitted it, and it seemed slow. I adjusted sleep to .01, it's a lot less slow. It does exactly what I was asking for. Thank you, thank you, thank you! I suppose that I'll play with the sleep until it no longer works, then back it off a tiny bit. There is a humorous side to this: I've played this game manually for so long, muscle memory is getting in the way! Again, thank you, CyteBode
Runaway1956 8 months ago