User Tools

Site Tools


macros:example:toggletriggermappings

Example

Trigger - Toggle Trigger Mappings v10/v11

by: Sebastian Beutel
published: January 2018
description: Toggles trigger mappings on/off (without entering system mode).
remarks: Idea from facebook group: https://www.facebook.com/groups/Avolites/permalink/1163736800425219/

This is version dependent

The way how Titan assigns IDs to mappings has changed. In short, in Titan v10 the macro works with Triggers.ToggleMappingEnable(2). In Titan v11 try something like Triggers.ToggleMappingEnable(1817). From Titan v12, use Triggers.ToggleMappingEnabledByHandle instead and define the mapping by its user number. See Triggers.ToggleMappingEnable for details.

functions

Code v10

ToggleTriggerMappings.xml
<?xml version="1.0" encoding="utf-8"?>
<avolites.macros>
 
<!-- the first two trigger mappings are predefined and fix, thus the first user mapping is ID 2 -->
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.1" name="Toggle Triggermapping 1">
    <description>Toggle Triggermapping 1.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(2)</step>
    </sequence>
  </macro>
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.2" name="Toggle Triggermapping 2">
    <description>Toggle Triggermapping 2.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(3)</step>
    </sequence>
  </macro>
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.3" name="Toggle Triggermapping 3">
    <description>Toggle Triggermapping 3.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(4)</step>
    </sequence>
  </macro>
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.4" name="Toggle Triggermapping 4">
    <description>Toggle Triggermapping 4.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(5)</step>
    </sequence>
  </macro>
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.5" name="Toggle Triggermapping 5">
    <description>Toggle Triggermapping 5.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(6)</step>
    </sequence>
  </macro>
 
</avolites.macros>

Code v11

ToggleTriggerMappingsV11.xml
<?xml version="1.0" encoding="utf-8"?>
<avolites.macros>
 
<!-- from v11 the mapppingIds are titanIds and may change. This may or may not work. -->
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.v11.1" name="Toggle Triggermapping v11 1">
    <description>Toggle Triggermapping v11 1.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(1817)</step>
    </sequence>
  </macro>
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.v11.2" name="Toggle Triggermapping v11 2">
    <description>Toggle Triggermapping v11 2.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(1818)</step>
    </sequence>
  </macro>
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.v11.3" name="Toggle Triggermapping v11 3">
    <description>Toggle Triggermapping v11 3.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(1819)</step>
    </sequence>
  </macro>
 
  <macro id="Avolites.Macros.Triggers.Mapping.Toggle.v11.4" name="Toggle Triggermapping v11 4">
    <description>Toggle Triggermapping v11 4.</description>
    <sequence>
      <step>Triggers.ToggleMappingEnable(1820)</step>
    </sequence>
  </macro>
 
</avolites.macros>

Explanation

This explains the functional steps within the sequence. For all the other XML details please refer to Formats and syntax

The macros use the function Triggers.ToggleMappingEnable to enable/disable trigger mappings. The first two mappings are predefined and cannot be altered, thus the user-defined mappings start with ID 2.

N.B. currently it is not possible to show whether a specific mapping is enabled using Active Binding as this requires a property, but there are no properties available for this purpose. (thanks to Gregory Haynes for explaining this)

How to use it

You could leave a comment if you were logged in.
macros/example/toggletriggermappings.txt · Last modified: 2020/01/26 11:47 by icke_siegen