Preset Selectors Guide
Last updated

Preset selectors are code that allow Beacon presets to target specific loot sources.

Preset selectors are a powerful tool to create dynamic presets that adapt to their usage.

To create a new preset selector, use the New Selector button inside the Selectors tab of the Presets view. The Preset Selector Builder window has 4 main elements: the selector name, the syntax format, the code area, and the Matched Loot Sources list. As the code is written and tested, the Matched Loot Sources list will update to help preview the effects. So let's talk about the code. The Syntax menu allows two options: Regular Expression and JavaScript.

Regular Expressions

In this mode, the code is a perl-compatible regular expression. Guides such as Learn X in Y minutes and PCRE Regex Cheatsheet to write your expressions. The expression is matched against the class string of the drop, such as SupplyCrate_Level65_Aberrant_Surface_C.

JavaScript

Beacon includes the DukTape JavaScript engine. The code written will be included in a function that expects a boolean return value. For example, writing just

return true;

in the Code area will match all sources. Match against the LootSource object, which has the following properties: Path, Class, Label, Mask, Multipliers, IconColor, Tags, and Experimental. Here is an example object:

{
    "Path": "/Game/PrimalEarth/Structures/SupplyCrate_Level03.SupplyCrate_Level03",
    "Class": "SupplyCrate_Level03_C",
    "Label": "Island White",
    "Mask": 333,
    "Multipliers": {
        "Min": 1.0,
        "Max": 1.0
    },
    "IconColor": "FFFFFF00",
    "Tags": [
        'island',
        'white',
        'drop'
    ],
  "Experimental": false
}

Users are most likely to want to match against the tags array. Expect the following tags, but this list might change over time:

  • aberration
  • alpha
  • artifact
  • beaver
  • blue
  • bonus
  • boss
  • cave
  • center
  • corrupted
  • crate
  • crystal_isles
  • cyan
  • dino
  • dragon
  • drop
  • easy
  • enraged
  • event
  • extinction
  • genesis
  • genesis2
  • gorilla
  • green
  • hard
  • island
  • king
  • legendary
  • manticore
  • medium
  • orange
  • orbital
  • purple
  • ragnarok
  • rare
  • red
  • scorched
  • spider
  • surface
  • valguero
  • white
  • wyvern
  • yellow

Thanks to these tags, selecting boss drops could be done with the following code:

return LootSource.Tags.indexOf('boss') > -1;

The values for LootSource.IconColor can be compared to the color variables ColorWhite, ColorGreen, ColorBlue, ColorPurple, ColorYellow, ColorRed, ColorCyan, and ColorOrange. The following would match all red drops:

return LootSource.IconColor === ColorRed;

The are also variables for map masking: MaskTheIsland, MaskScorchedEarth_P, MaskTheCenter, MaskRagnarok, MaskAberration_P, MaskExtinction, MaskValguero_P, MaskGenesis, MaskCrystalIsles, and MaskGen2. Additional mask variables are automatically introduced when maps are added, based on Ark's internal identifier for the map. Finding drops that can spawn on The Island can be done with

return (LootSource.Mask & MaskTheIsland) === MaskTheIsland;

Lastly there are two variables for Beacon version info, BeaconVersion and BeaconVersionString. BeaconVersion will appear as a number, such as 10502300. BeaconVersionString is human-readable and will appear as formatted on the Home view, such as 1.5.2.

    No Results

    Message

    Explanation