cactbot

Oopsy Raidsy Trigger Format

Oopsy File Format

Each file in this directory should be valid JavaScript and should be listed in manifest.txt.

Each file should look something like this:

[{
  zoneRegex: /match for the zone/,
  triggers: [
    { /* ..trigger 1.. */ },
    { /* ..trigger 2.. */ },
    { /* ..trigger 3.. */ },
  ]
},
{
  zoneRegex: /match for another zone/,
  triggers: [
    { /* ..trigger 1.. */ },
    { /* ..trigger 2.. */ },
    { /* ..trigger 3.. */ },
  ]
}]

Each file should evaluate to an array of trigger sets. A trigger set has a zoneRegex that matches against the current zone for whether all of its triggers should be applied. If the zone matches, then the triggers will be valid in that zone, otherwise ignored. triggers holds an array of triggers in the trigger set. See below for the format of each of individual triggers.

Oopsy Trigger format

Each trigger is an object with the following fields. All fields are optional.

mistake format

This will print “:no_entry_sign: Latke: Dynamo” in the live log.

mistake: function(event, data, matches) {
  return {
    type: 'fail',
    blame: e.targetName,
    text: 'Dynamo'
  };
},

This will print “:warning: WHOOPS” in the live log, even though a player was blamed.

mistake: function(event, data, matches) {
  return {
    type: 'warn',
    blame: e.targetName,
    fullText: 'WHOOPS',
  };
},

deathReason format

If this following trigger is used, then if a player dies without taking any other damage, the log would show “:skull: Chippy: Doom Debuff” instead of assigning it to the last damage the player took before this trigger, which might incorrectly look more like “:skull: Chippy: Auto (3034/38471)”.

deathReason: function(event, data, matches) {
  return {
    name: event.targetName,
    reason: 'Doom Debuff',
  },
},

Oopsy Trigger Function Parameters

Every function in an oopsy trigger gets three parameters: event, data, matches in that order.

Event Fields

Every function specified in a trigger gets an event (or events) object. This object has different fields depending on which type of regex was used to match the trigger.

All Events

Effect Events (gainsEffectRegex, losesEffectRegex)

Ability Events (healRegex, damageRegex, abilityRegex)

data.IsPlayerId(id) can be used against the attackerId or the targetId to determine if that id represents a player.

Current hp/mp/tp values are not 100% precise. ACT polls these values periodically and so it may be out of date by one HoT/DoT tick. The most important consideration is that damage that does more than current hp may not actually be fatal, and vice versa that damage that does less than current hp may turn out to be fatal. There’s no way to know until the ‘was defeated’ message shows up two seconds later.

Single Event Example

In most cases, a single event will be passed to every function.

{
  // 26BB is the ability id for Nael's Iron Chariot.
  damageRegex: '26BB',
  mistake: function(event, data, matches) {
    // event here is a single event object
    console.log(event.targetName);
  },
},

Multiple Event Example (Collection)

If collectSeconds is used, then as soon as the trigger matches any line, it will wait collectSeconds and then pass that first trigger and any additional trigger that matches during that time period as an array.

condition always takes a single event and acts as a filter prior to collecting events. If condition is not true, then it as if the log line didn’t exist and the event is skipped, both for the initial match and for the collection.

delaySeconds is not called when collecting.

{
  // Succor
  healRegex: 'BA',
  collectSeconds: 0.2,
  mistake: function(events, data, matches) {
    // events here is an array of event objects
    for (var i = 0; i < events.length; ++i)
      console.log(events[i].targetName);
  },
},

Data Fields

data is an object that persists for an entire fight and is reset on wipe. It is passed to every function.

data comes preopulated with the following fields:

data is something that triggers can and should store state on, if state is needed to be tracked across multiple triggers.

For example, if you want to store a map of which players have doom or not, that could be stored in data.hasDoom. This could then be used across multiple triggers.

{
  // Match both gains and loses in the same trigger.
  gainsEffectRegex: 'Doom',
  losesEffectRegex: 'Doom',
  run: function(e, data) {
    data.hasDoom[e.targetName] = e.gains;
  },
},

Match Fields

matches is literally the regex match object returned from whatever regex this trigger matched. matches[0] is always the full match, with other array entries being any other groups from the regex (if any). In the case of the single event above, matches[0] === 'Iron Chariot'.

Trigger Field Evaluation Order

The full order of evaluation of functions in a trigger is:

  1. match against regex
  2. check if id is disabled
  3. condition
  4. collectSeconds
  5. delaySeconds (only if not collecting)
  6. (delay and waiting for collecting happens here)
  7. mistake
  8. deathReason
  9. run