0

I am searching for a free software to create macros for games on Linux, that could work on any keyboard with a GUI.

I want it to do successive keystrokes and tweak the delay between each key.

marked as duplicate by wjandrea, Ravexina, Eric Carvalho, Charles Green, user364819 May 4 '17 at 8:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It's not the same program and my scripts are dedicated for games with multiple inputs and delay. And i am not sure xbindkey would works in video games or is easier to use. – Danyl Bekhoucha May 2 '17 at 18:54
  • Yes, it's not exactly the same question, but it is essentially the same. You may want to give your question more detail to set it apart from the question I linked, then I would remove the duplicate flag. – wjandrea May 2 '17 at 20:32
3

You must install the software Autokey on the Software Manager.

Open it and click on New then Script and name it (you can also create a folder with the name of your game).

Keyboard

There is two important lines, here is the code for pressing the key "x":

keyboard.send_keys("x")

And here is how to add a delay, 1/10 of a second (try lower values until the game doesn't allow it, also keep in mind than an high ping can make some keys doesn't input if the delay is too low):

time.sleep(0.1)

Then repeat the code by adding a delay between each keys, for the last key you don't need to add a delay after it.

To hold a key type that, for example to hold then release Shift and typing x in between:

keyboard.press_key("<shift>")
keyboard.send_keys("x")
keyboard.release_key("<shift>")

Mouse

To click use this two commands:

mouse.click_relative_self(x, y, button)

mouse.click_absolute(x, y, button)

The first command is relative (to click near the mouse's current location) the second is absolute (from the entire screen). The button takes 3 arguments:

1: left click

2: middle click

3: right click

This script work best if you add a minimum of 0.1 second of sleep. Here an example to click at the center of the screen:

time.sleep(0.1)
mouse.click_absolute(1920/2, 1080/2, 1)

Comment

You can add a comment with "#":

keyboard.send_keys("x") # use a potion

Once your script is finished you can bind it to a key, bellow your script you will see script settings, at the line Hotkey click on Set and define a key. I recommend you to use the key F# to attach it or the key. You can test if your macro is working by opening a text editor like gedit.

Also for Dota you will have to set the key in autocast mode to not have to click with the mouse.

Here is what the script looks like (hero Clinkz in Dota):

enter image description here

About timing in Dota: the lowest safe timing i have found for Dota is 0.07 second, some animation increase the Delay before another input. For projectiles like Ethereal Blade i use 0.5 second or use abilities in between to be sure that it hits before a Dagon shot or nuke ability.

Also after the first macro key i add a delay 0.2 sec delay because of the turn rate of the character to let him face the ennemy before then i use 0.07 second for the other macros. For abilities with animation i use 0.2 or 0.3.

To test your macros in Dota choose an hero then go in "Demo hero". You can use those commands: http://dota2.gamepedia.com/Cheats

Not the answer you're looking for? Browse other questions tagged or ask your own question.