Mouse button macros

Post Reply
User avatar
Xcessity
Site Admin
Posts: 286
Joined: Sat May 16, 2015 2:23 pm
Location: Graz
Contact:

Mouse button macros

Post by Xcessity »

Hi,

I got these questions from a user on a different forum:
  1. In mouse settings enable an option for repeatedly pressing a mouse button every X milliseconds. For example many games with pistols or shot guns can only be fired via pressing repeatedly or button mashing. Doing this repeatedly with facial actions will be much slower than automating. I imagine you could do your facial feature such as smile left and then it will repeatedly press the left mouse button every 300 ms until I do smile left action to stop it. Of course, some guns may only be able to fired every 500 ms so best if this is easily changeable.
  2. The ability to bind more mouse buttons. I have a fwd and back button on my mouse which are set as defaults in some games.
  3. Actually, an option for burst fire may be good too. Hold lmb for x milliseconds and release for x milliseconds and hold again repeating until action performed
All these three suggestions can be performed using macros. Using the following macro presses the left mousebutton as long as you hold the expression active:

Code: Select all

<MACRO id="ShootWeaponReapeatedly">
  <MAIN repeat="x">
    <MOUSEBUTTONINPUT button="LEFT" behaviour="PRESS"/>
    <MOUSEBUTTONINPUT button="LEFT" behaviour="RELEASE"/>
    <WAIT time="300"/>
  </MAIN>
</MACRO>
If you want to toggle the macro above with a single expression you can use the following macro. NOTE: you also need to include the macro from above in the macro file but only bind the macro below to the expression you like:

Code: Select all

<MACRO id="ShootWeaponReapeatedlyToggle">
  <MAIN repeat="1">
    <CONDITION>
      <MACROCONDITION idref="ShootWeaponReapeatedly" condition="ACTIVE"/>
      <REFERENCE idref="ShootWeaponReapeatedly" behaviour="STOP"/>
      <REFERENCE idref="ShootWeaponReapeatedlyToggle" behaviour="STOP"/>
    </CONDITION>
    <CONDITION>
      <MACROCONDITION idref="ShootWeaponReapeatedly" condition="INACTIVE"/>
      <REFERENCE idref="ShootWeaponReapeatedly" behaviour="START"/>
      <REFERENCE idref="ShootWeaponReapeatedlyToggle" behaviour="STOP"/>
    </CONDITION>
  </MAIN>
</MACRO>

The solution to request 2 can also be solved using a macro. Any mouse buttons besides the left, middle and right are called "xbutton". These xbuttons are also enumerated and most of the times the thumb buttons are 1. and 2. To bind these buttons you can use the following macro. Change the xbutton by increasing the value 1 in xbutton="1".

Code: Select all

<MACRO id="MouseXButton1">
  <MAIN repeat="1">
    <MOUSEBUTTONINPUT button="XBUTTON" behaviour="PRESS" xbutton="1"/>
  </MAIN>
</MACRO>


The macro for 3. is pretty similar to the one above. Just insert a second wait between the PRESS and RELEASE. If different weapons have different timings I would suggest creating a specific macro for each weapon. You can use profiles for assigning different macros to the same expression. This macro will hold the mouse button for 200ms and then idle for 300ms.

Code: Select all

<MACRO id="ShootWeaponBurstfire">
  <MAIN repeat="x">
    <MOUSEBUTTONINPUT button="LEFT" behaviour="PRESS"/>
     <WAIT time="200"/>
    <MOUSEBUTTONINPUT button="LEFT" behaviour="RELEASE"/>
    <WAIT time="300"/>
  </MAIN>
</MACRO>
User avatar
Xcessity
Site Admin
Posts: 286
Joined: Sat May 16, 2015 2:23 pm
Location: Graz
Contact:

Re: Mouse button macros

Post by Xcessity »

Hi,

here is a macro that performs a middle mouse button click:

Code: Select all

<MACRO id="MouseMiddleClick">
  <MAIN repeat="1">
    <MOUSEBUTTONINPUT button="MIDDLE" behaviour="PRESS"/>
     <WAIT time="200"/>
    <MOUSEBUTTONINPUT button="MIDDLE" behaviour="RELEASE"/>
  </MAIN>
</MACRO>
Post Reply