Difference between revisions of "Macros"

From GIMX
Jump to: navigation, search
Line 133: Line 133:
 
F2 and F4 are default active. If F6 is pressed, F3 becomes active, F2 and F4 become inactive.<br />
 
F2 and F4 are default active. If F6 is pressed, F3 becomes active, F2 and F4 become inactive.<br />
 
With GIMX 2.00:<br />
 
With GIMX 2.00:<br />
Macros with a trigger are default inactive. To make a macro with trigger default active, add "INIT ON" after the "TRIGGER <event>" line.<br />
+
Macros with a trigger are default inactive. To make a macro with trigger default active, add a line containing "INIT ON" after the "TRIGGER <event>" line.<br />
Macros with a trigger can work with a toggle mode. This can be configured adding "TOGGLE ON" after the "TRIGGER <event>" line.<br />
+
Macros with a trigger can work with a toggle mode. This can be configured adding a line containing "TOGGLE ON" after the "TRIGGER <event>" line.<br />
  
 
==Notes== <!--T:15-->
 
==Notes== <!--T:15-->

Revision as of 09:44, 16 July 2014

Other languages:
English • ‎français

It's possible to configure keyboard/mouse/joystick macros: a key or button press can trigger a series of keyboard/mouse/joystick events, with timing conditions.

Directory

Macros have to be defined in files saved into:

  • Ubuntu: the ~/.emuclient/macros directory. ~ is the home directory, and .emuclient folder is hidden (in the file manager, press ctrl+h to display hidden folders).
  • Windows: the C:\Users\<username>\AppData\Roaming\emuclient\macros directory.

GIMX 0.51 and older:

  • Windows 32bits: the C:\Program Files\GIMX\macros directory.
  • Windows 64bits: the C:\Program Files (x86)\GIMX\macros directory.

Syntax

MACRO <DEVICE EVENT> <ID>
<DEVICE EVENT> <ID> <VALUE>
DELAY <MS>
#<COMMENT>
<DEVICE EVENT>: KEY, KEYDOWN, KEYUP, MBUTTON, MBUTTONDOWN, MBUTTONUP, JBUTTON, JBUTTONDOWN, JBUTTONUP, MAXIS, JAXIS
<ID>: the event id (case sensitive) as displayed in gimx-config
<VALUE>: the axis value (only for MAXIS and JAXIS)
<MS>: integer value in milliseconds
<COMMENT>: a comment, not interpreted

Commands

  • KEYDOWN: keyboard key pressed
  • KEYUP: keyboard key released
  • KEY: KEYDOWN + DELAY 50 + KEYUP
  • MBUTTONDOWN: mouse button pressed
  • MBUTTONUP: mouse button released
  • MBUTTON: MBUTTONDOWN + DELAY 50 + MBUTTONUP
  • JBUTTONDOWN: joystick button pressed
  • JBUTTONUP: joystick button released
  • JBUTTON: JBUTTONDOWN + DELAY 50 + JBUTTONUP
  • DELAY: delay in milliseconds
  • MAXIS: mouse axis moved

ID: 0 for x axis, and 1 for y axis
VALUE: positive values for right and down

  • JAXIS: joystick axis moved

ID: the axis id as displayed in gimx-config
VALUE: in [-32768 .. 32767] for centered axes, and in [0 .. 32767] for non-centered axes

Example1: rapid_fire.txt

MACRO MBUTTONDOWN BUTTON_LEFT
KEYDOWN p
DELAY 50
KEYUP p
DELAY 50
MBUTTONDOWN BUTTON_LEFT

MACRO MBUTTONUP BUTTON_LEFT
KEYUP p
MBUTTONDOWN BUTTON_LEFT

'p' is bind to r1 in both hip fire and ADS profiles.
'BUTTON_LEFT' is NOT bind to r1 in both hip fire and ADS profiles.

Example2: recoil.txt

MACRO KEYDOWN o
MAXIS 1 25
KEYDOWN o

MACRO MBUTTONDOWN BUTTON_LEFT
KEYDOWN o

MACRO MBUTTONUP BUTTON_LEFT
KEYDOWN o

Change '25' with the value in [0..128] that cancels the recoil.

Macro activation

This section is only applicable since GIMX 1.00.

It is possible to specify the macro files to be read for each configuration file.
This can be configured in a file named "configs.txt", located in the macros directory.
Example:

#If config1.xml is loaded, macro1.txt is read.
config1.xml macro1.txt
#If config1.xml is loaded, macro2.txt is read.
config1.xml macro2.txt
#If config2.xml is loaded, macro2.txt is read.
config2.xml macro2.txt

Lines beginning with a # are not interpreted.

It is also possible to define activation triggers within the macro definition.
The syntax is:

TRIGGER <event>

Example:

MACRO F1
#content

MACRO F2
TRIGGER F5
#content

MACRO F3
TRIGGER F6
#content

MACRO F4
TRIGGER F5
#content

With GIMX 1.12 and earlier, the above example works the following way:
F1 remains active all the time as there is no trigger specified.
F2 and F4 are default active. If F6 is pressed, F3 becomes active, F2 and F4 become inactive.
With GIMX 2.00:
Macros with a trigger are default inactive. To make a macro with trigger default active, add a line containing "INIT ON" after the "TRIGGER <event>" line.
Macros with a trigger can work with a toggle mode. This can be configured adding a line containing "TOGGLE ON" after the "TRIGGER <event>" line.

Notes

Delay precision

The delay precision depends on the controller update period:

  • sixaxis/bluetooth = 11.25ms
  • sixaxis/usb = 10ms
  • 360 pad = 8ms

If you specify a delay that is not a multiple of the precision, the resulting delay will be the lowest multiple of the precision higher than the specified delay.
For example, if the precision is 11.25ms and the delay is 12ms, the resulting delay will be 22.50ms (=2*11.25ms).

Macro loop

To make a macro loop, just add a KEYDOWN or MBUTTONDOWN or JBUTTONDOWN command at the end of the macro definition.
Example:

MACRO MBUTTONDOWN BUTTON_LEFT
KEYDOWN p
DELAY 50
KEYUP p
DELAY 50
MBUTTONDOWN BUTTON_LEFT

The macro is triggered by pressing 'BUTTON_LEFT'.
The last command of the macro restarts the macro, creating a loop.
To stop a macro loop, just press the trigger again. The macro is stopped immediately, and the state of the controller is unchanged.

Multiple keyboards/mice/joysticks

In case multiple keyboards or mice or joysticks are used, it's not possible to specify the device for which events are generated.
Events are generated for the first keyboard/mouse/joystick found in the configuration.