Some better mouse macros

Post Reply
Zathras
Posts: 68
Joined: Thu May 21, 2015 4:09 pm
Location: NY

Some better mouse macros

Post by Zathras »

Here are some macros I made I thought I'd share.

These ones will toggle the right or left mouse button with a single interactor. By default Iris includes separate mouse down and up macros. With these you only need 1 interactor to toggle right click and 1 to toggle left.

Code: Select all

 
  <MACRO id="ToggleRightClick">
    <MAIN>
      <CONDITION>
        <VARIABLECONDITION id="right_button_down" condition="NOT_EQUAL" value="1"/>
        <MOUSEBUTTONINPUT button="RIGHT" behaviour="PRESS"/>
        <VARIABLE id="right_button_down" function="SET" value="1"/>
        <REFERENCE behaviour="STOP" idref="ToggleRightClick"/>
      </CONDITION>

      <MOUSEBUTTONINPUT button="RIGHT" behaviour="RELEASE"/>
      <VARIABLE id="right_button_down" function="SET" value="0"/>
    </MAIN>
  </MACRO>

  
  <MACRO id="ToggleLeftClick">
    <MAIN>
      <CONDITION>
        <VARIABLECONDITION id="left_button_down" condition="NOT_EQUAL" value="1"/>
        <MOUSEBUTTONINPUT button="LEFT" behaviour="PRESS"/>
        <VARIABLE id="left_button_down" function="SET" value="1"/>
        <REFERENCE behaviour="STOP" idref="ToggleLeftClick"/>
      </CONDITION>

      <MOUSEBUTTONINPUT button="LEFT" behaviour="RELEASE"/>
      <VARIABLE id="left_button_down" function="SET" value="0"/>
    </MAIN>
  </MACRO>
And these ones will hold the right or left button for as long as you look at the interactor... or make the gesture for Kinesic users...

Code: Select all

  <MACRO id="HoldRightClick">
    <START>
      <!--in case the right button is down from the RightClickOn we need to release it first -->
      <CONDITION>
        <VARIABLECONDITION id="right_button_down" condition="EQUAL" value="1"/>
        <MOUSEBUTTONINPUT button="RIGHT" behaviour="RELEASE"/>
        <VARIABLE id="right_button_down" function="SET" value="0"/>
      </CONDITION>

      <MOUSEBUTTONINPUT button="RIGHT" behaviour="PRESS"/>
	</START>

    <MAIN repeat="x">
      <WAIT time="1000"/>
    </MAIN>

    <END>
      <MOUSEBUTTONINPUT button="RIGHT" behaviour="RELEASE"/>
    </END>
  </MACRO>

  
  <MACRO id="HoldLeftClick">
    <START>
      <!--in case the left button is down from the LeftClickOn we need to release it first -->
      <CONDITION>
        <VARIABLECONDITION id="left_button_down" condition="EQUAL" value="1"/>
        <MOUSEBUTTONINPUT button="LEFT" behaviour="RELEASE"/>
        <VARIABLE id="left_button_down" function="SET" value="0"/>
      </CONDITION>

      <MOUSEBUTTONINPUT button="LEFT" behaviour="PRESS"/>
	</START>

    <MAIN repeat="x">
      <WAIT time="1000"/>
    </MAIN>

    <END>
      <MOUSEBUTTONINPUT button="LEFT" behaviour="RELEASE"/>
    </END>
  </MACRO>
Hope someone finds these useful.
Post Reply