Lua variables in Logitech macros
Contents
- Turning macros on and controlling them
- OFF_ON_MACROS_KEY
- LANGUAGE
- HELP_MODE
- SHOW_STAGES_STEPS
- RMB_MODE
- IN_SIGHT_MODE
- T_MODE
- OFF_ON_CTRL_MODE
- CLICKER_ACTIVATION_BUTTON
- %WeaponName%_G_BUTTON
- Compensation and sensitivity
- MACROS_COMPENSATION
- R_SPEED
- COMPENSATION_ONLY_CTRL
- MODULES_FACTOR
- MODULES_FACTOR_POWER
- %WeaponName%_POWER
- INVERSION
- INVERSION_AXIS_Y
- Randomness
- HUMAN_RANDOM
- DELAY_RANDOM_GAP
- OX_RANDOM_GAP
- OY_RANDOM_GAP
- RANDOM_XY_MODE
- RANDOM_XY_VALUE
- RANDOM_DELAY_MODE
- AVL_SPRAY
- AVL_RANDOM
Our packs for Logitech mice are Lua programs, and all their settings are variables at the top of the script. This page describes each of them: what it does, which values it takes and what it’s set to by default.
To change a setting, open the script in G HUB, change the variable’s value, then save the script and run it again: changes don’t apply until you do. The set of variables depends on the pack and its version.
Turning macros on and controlling them
OFF_ON_MACROS_KEY
The key that turns macros on globally. By default it’s CapsLock (value "capslock"); you can change it to "numlock" or "scrolllock".
local OFF_ON_MACROS_KEY = "capslock"
While the assigned lock key is off, no macro functions work at all.
LANGUAGE
The language of the messages in the G HUB console: Russian ("RU") or English ("EN").
local LANGUAGE = "EN"
HELP_MODE
Help mode: pressing the mouse wheel prints basic instructions for the Lua program in the G HUB console. On by default; set to false to turn it off.
local HELP_MODE = true
SHOW_STAGES_STEPS
Shows the steps of the running macro in the Logitech G HUB script console.
local SHOW_STAGES_STEPS = true
Stage: 2
Total steps: 40
RMB_MODE
Makes macros work with the right + left mouse buttons (aiming mode). With false macros run while you hold the LMB; with true you first hold the RMB (aim), then the LMB.
local RMB_MODE = false
RMB + LMB is more convenient: macros don’t fire during ordinary LMB actions (inventory and other interactions), so you don’t have to turn them off with CapsLock.
IN_SIGHT_MODE
Chooses when macros fire: while holding the LMB alone (false) or in aiming mode, while holding RMB + LMB (true). Default: true.
local IN_SIGHT_MODE = true
T_MODE
A mode for tapping, that is, firing one shot at a time: with true, single shots don’t trigger the macro. Off by default.
local T_MODE = false
If you hold the LMB with T_MODE on, macros work in PRO mode as usual, with a small “jump” after the first shot. If you don’t tap often, keep this mode off.
OFF_ON_CTRL_MODE
Makes macros work only while crouching: in many games that’s the most effective position for shooting with macros. Default: false.
local OFF_ON_CTRL_MODE = false
CLICKER_ACTIVATION_BUTTON
The key that, while held, makes a semi-automatic weapon fire fully automatically at or near its maximum rate of fire. Left ALT by default.
local CLICKER_ACTIVATION_BUTTON = "lalt"
Left ALT works best, but you can replace it with left CTRL ("lctrl") or left SHIFT ("lshift").
In the Battle Royale packs the same key is set with the AUTO_MODE_KEY variable:
local AUTO_MODE_KEY = "lalt"
%WeaponName%_G_BUTTON
Assigns a weapon mode to a G key of a Logitech keyboard. 0 (default) means no key; 1–12 is the G key number: 1 is G1, 2 is G2 and so on (the G213 Prodigy, for example, has 12).
If any G_BUTTON variable is not 0, the standard keyboard + mouse combination for that weapon is turned off.
local AK47_G_BUTTON = 0
local SG553_G_BUTTON = 0
local FAMAS_G_BUTTON = 0
local M4A1_S_G_BUTTON = 0
local MP7_G_BUTTON = 0
local BIZON_G_BUTTON = 0
local P90_G_BUTTON = 0
local AWP_SSG_G_BUTTON = 0
local GALIL_G_BUTTON = 0
local AUG_G_BUTTON = 0
local M4A4_G_BUTTON = 0
local MP5SD_G_BUTTON = 0
local MP9_G_BUTTON = 0
local MAC_10_G_BUTTON = 0
local UMP45_G_BUTTON = 0
local CLICKER_G_BUTTON = 0
Before assigning G keys, set them up in G HUB and bind separate macros to them. How many G keys a keyboard has and whether they can be bound to Lua scripts, only Logitech support can tell you in advance: even G keys listed in the keyboard’s specs don’t guarantee they’ll work in Lua scripts.
Compensation and sensitivity
MACROS_COMPENSATION
After you release the LMB, returns the crosshair to where it would have been without the macro: macros move the mouse, and when you stop firing those movements are compensated.
local MACROS_COMPENSATION = "scrolllock"
Takes the values "capslock", "scrolllock" or "numlock".
R_SPEED
The compensation speed when MACROS_COMPENSATION is on. Default: 12.
local R_SPEED = 12
COMPENSATION_ONLY_CTRL
Limits MACROS_COMPENSATION: compensation works only while crouching. Default: false.
local COMPENSATION_ONLY_CTRL = false
MODULES_FACTOR
Turns on the attachments multiplier, to raise or lower the sensitivity of all macros with the MODULES_FACTOR_POWER variable.
local MODULES_FACTOR = false
It’s also a way to adapt macros to non-standard game settings.
MODULES_FACTOR_POWER
The sensitivity of all macros in the pack: the higher the value, the more the macros move the crosshair. Works only when MODULES_FACTOR is on (true).
local MODULES_FACTOR_POWER = 0.76
If you use attachments that reduce recoil, lower the value until the macro stops pulling the crosshair down for that weapon.
We don’t recommend this feature unless you fully understand how it works and are sure you need it: if you follow the game settings and attachment requirements, you’ll almost always get the same or a better result.
%WeaponName%_POWER
The strength of recoil compensation in “ONE TAP” mode, that is, single shots from a semi-automatic weapon. The default value matches the crosshair shift on the first shot; each such weapon has its own variable.
local SKS_POWER = 44
local M16A4_POWER = 27
local MINI14_POWER = 40
local DRAGUNOV_POWER = 55
local SLR_POWER = 52
local MK12_POWER = 50
local MK47_MUTANT_POWER = 27
If the compensation isn’t enough (you click faster than the weapon returns to its original position), raise the value for that weapon; if the crosshair goes down, lower it. Full-auto fire from a semi-automatic weapon is turned on with the CLICKER_ACTIVATION_BUTTON key.
INVERSION
Inverts the macros on the vertical axis (with true). You need it if you play with mouse inversion. Default: false.
local INVERSION = false
INVERSION_AXIS_Y
Inverts all macros on the vertical axis (Y). Only needed if you play with vertical mouse inversion.
local INVERSION_AXIS_Y = false
Randomness
HUMAN_RANDOM
Adds controlled randomness to the recoil on any axis and to the delays between movements. Takes true and false.
local HUMAN_RANDOM = false
The amount of randomness is set by DELAY_RANDOM_GAP, OX_RANDOM_GAP and OY_RANDOM_GAP.
DELAY_RANDOM_GAP
A HUMAN_RANDOM parameter: the maximum random addition to the delays between macro movements, in milliseconds. Recommended value: the time between two shots divided by 20, which is 2 to 6 ms on average.
local DELAY_RANDOM_GAP = 2
OX_RANDOM_GAP
A HUMAN_RANDOM parameter: the amount of randomness in macro movements on the horizontal axis.
local OX_RANDOM_GAP = 1
OY_RANDOM_GAP
A HUMAN_RANDOM parameter: the amount of randomness in macro movements on the vertical axis.
local OY_RANDOM_GAP = 1
RANDOM_XY_MODE
Adds small random deviations to the recoil control (with true), which noticeably lowers the chance of a ban. On by default in all Logitech packs.
local RANDOM_XY_MODE = true
RANDOM_XY_VALUE
The size of the random deviations for RANDOM_XY_MODE. Recommended values: 0.8 to 1.2 (for the latest pack versions).
local RANDOM_XY_VALUE = 1
RANDOM_DELAY_MODE
Adds small random values to the delays in macros (with true). Not recommended without RANDOM_XY_MODE.
local RANDOM_DELAY_MODE = false
AVL_SPRAY
Leaves the macro in control of the horizontal recoil only, the hardest part, while you handle the vertical recoil yourself (with true). Works like AVL macros for A4Tech mice.
local AVL_SPRAY = false
AVL_RANDOM
Adds a little randomness to the recoil of all macros in the Lua program (with true). Recoil may grow slightly.
local AVL_RANDOM = false
