Trigger Functions - Jamiras/RATools GitHub Wiki

repeated(count, comparison)

Adds a Hit Target to the condition. The specified comparison must be true for count frames for the trigger to fire. The frames do not have to be consecutive. Once the Hit Target is met, the condition is considered true until it is reset.

once(comparison)

Shorthand for repeated(1, comparison). The specified comparison must have been true at one point, but is not required to currently be true to trigger the achievement.

tally(count, comparisons...)

Adds a Hit Target to the condition where multiple conditions may be true in the same frame. comparison may be an array of conditions, or multiple conditions passed as individual parameters. Each condition that is true on each frame will tally a Hit Count. Multiple Hit Counts may be tallied in the same frame. The overall tally must reach count for the trigger to fire. Once the Hit Target is met, the condition is considered true until it is reset.

Individual conditions in the comparisons list may be wrapped in a deduct() function call, which causes any hits counted by the condition to be deducted from the overall tally.

If count is zero, the overall condition will become true as soon as any individual comparison is true. This is mostly used when building leaderboard value clauses using the measured function as it provides an unbounded counting of the subclauses.

never(comparison)

This becomes a ResetIf. If the comparison is true, all Hit Counts in the trigger are reset to 0, and the trigger cannot fire.

unless(comparison)

This becomes a PauseIf. The group containing the PauseIf is not processed while the condition is true, and the trigger cannot fire.

unless has precedence over never. A paused group will not evaluate it's reset statements. If the comparison is a repeated condition, once the Hit Target has been met, the group will be "Pause Lock"ed until a never resets it's Hit Count from another group. See also Runtime Processing Notes.

measured(comparison, when=always_true(), format="raw")

This adds a Measured flag to the comparison. If the comparison is repeated, the Measured value will be the current number of hits on the condition, and the measurement target will be the Hit Target for the condition. Otherwise, the Measured value will be the left side value and the measurement target will be the right side value (regardless of the comparison operation).

When used in an achievement, Measurements are displayed in the overlay. Use the when parameter to specify a secondary condition that must be true for the Measured value to be reported (i.e. for achievements where the player must be using a specific character). If the when condition is false, the Measured value will be 0, regardless of the values in the associated memory. Both the comparison (and when condition if provided) must be true for the achievement to trigger.

format may be set to percent to change the display in the overlay to report a percentage instead of the raw measured value (i.e. 75% instead of 3/4)

When used in rich presence or leaderboards, the Measured value is captured and the measurement target is ignored.

Using with complex conditions

comparison may be a series of AND'd or OR'd conditions. This will cause repeated, once, and measured to generate a series of OrNext and AndNext conditions, and never and unless will generate a series of ResetIf/PauseIf conditions.

trigger_when(comparison)

This adds a Trigger flag to the comparison, which tells the runtime that the specified conditions are the last conditions that will be true for the achievement. When all other logical conditions are true, the runtime may display an indicator on-screen to let the user know they're close to completing an achievement. Should be used for tracking challenges, like defeating a boss without taking damage.

disable_when(comparison, until=always_false())

This adds a PauseIf flag and a hit target to the comparison. If comparison is not a repeated() condition, the hit target will be 1, otherwise the hit target will come from the repeated() function call. When the hit target is met, the runtime will disable the achievement indefinitely. This is most often used to disable achievements while a cheat is active.

If until is specified, it will generate a ResetNextIf condition attached to the PauseIf, which will clear the hit count when true, thereby re-enabling the achievement.