Skip to content

Conversation

@MnFeN
Copy link
Contributor

@MnFeN MnFeN commented Aug 17, 2024

Ternary expression for strings

Shortcut: Ctrl+Shift+I

image

Debug Trigger Generator

Generates a debug trigger by the given log lines.

image

image

Accessing OverlayPlugin Entity Data

Currently only available by scripts:

using Triggernometry.PluginBridges;
public static List<BridgeOverlay.OpCombatants> BridgeOverlay.GetCombatants(bool queryStatus)

example:

using System.Windows.Forms;
using System.Linq;
using Triggernometry.PluginBridges;

var combatants = BridgeOverlay.GetCombatants(false);

// Properties only available in OverlayPlugin:
OpCombatants combatant = combatants.FirstOrDefault(c => c.WeaponId == 4 && c.PosX > 100);
MessageBox.Show(combatant.ID.ToString("X8"));

Other small adjustments

MnFeN and others added 30 commits July 26, 2024 01:20
Generate a debug trigger from several given loglines and set delays based on the timestamp. The trigger would simulate the loglines when fired.
also fixed some typo and removed unused text
· Showing the "Startup" title correctly
· Add the tooltip to the corresponding labels
· When no window name is specified, treat it as an attempt to match all windows.
· Correctly accept combination keys, such as `Ctrl + A`.
· Extract the logic related to `procid` to avoid repeated window searches during iteration.
· move some codes from ProxyPlugin to BridgeFFXIV
· fix the plugin type "FFXIV_ACT_Plugin.FFXIV_ACT_Plugin"
· change the PluginWrapper to a general class for all plugins, and move the version verification into BridgeFFXIV
· other small changes
The structure is nearly unchanged (partial class)
· Empty condition groups in triggers/actions
· SoundRouting and TTSRouting
(missed one file previously)
Getting combatant data from overlay plugin which includes more entities and more properties.
fix: Add Missing Repository Update Timeout
Fix: Compatible with progress bar
MnFeN added 12 commits January 27, 2025 13:23
…cters added in 7.1

e.g. ${func:towhitechar:123}
The previous function was renamed to `toblackchar`
e.g. ${_waymark[A].active}  ${_waymark[One].x}  ${_waymark[6].xyz}
e.g. ${_waymark[A].active}  ${_waymark[One].x}  ${_waymark[6].xyz}
· Entity-related expression and actions can now get more entities and more properties from OverlayPlugin

· Property names are now case-insensitive

· Entity filter could be provided as a numeric expression:
`${_ffxiventity[IsT && HasStatus(0x32) && Distance < 5].ID}`

· Multiple properties could be queried at the same time:
·${_me.X, Y, Z, Heading}·
@MnFeN
Copy link
Contributor Author

MnFeN commented Jan 30, 2025

2025.1.

A brief introduction of entity-related functions after allowing Triggernometry to get data from OverlayPlugin:

Entity

Retrieving via Text Expressions

Triggernometry now provides text expressions for retrieving specific entities:

Retrieval Method Expression Example
Self ${_me.property_expression} ${_me.Heading}
Target ${_tgt.property_expression} ${_tgt.HasStatus(50)}
Specific ID ${_entity[HexID].property_expression} ${_entity[103CDDB2].X, Y}
Specific Name ${_entity[Name].property_expression} ${_entity[Striking Dummy].ID}
By Other Attributes ${_entity[filter_expression].property_expression} ${_entity[BNpcID=12306].Z}

Notes:

  • The retrieval process iterates through the entity list and returns the first entity that meets the criteria. If multiple entities match, the behavior may be random.
  • ${_tgt.property} is equivalent to ${_entity[${_me.TargetID}].property} in program behavior.
  • _entity is the abbreviation for _ffxiventity.
  • The expression inside [ ] is used to filter specific entities, while the part after . specifies the property to return.

Tip

A property expression includes not only "properties" in a programming sense (e.g., .Name) but also "methods" that accept parameters (e.g., .HasStatus(statusid)).

When writing triggers, you don’t need to distinguish between them; in this document, both are referred to as "properties".

This clarification is provided to avoid confusion among readers with programming knowledge.

Filter Expressions

Entity filter expressions are used to filter entities from the entire list based on certain conditions. They come in several forms:

  • Hex ID

    Directly specify the hexadecimal ID, e.g., ${_entity[103CDDB2].HP}

  • Name

    Directly specify the name, e.g., ${_entity[Striking Dummy].HP}

Warning

Names vary across different language settings and may conflict between players and NPCs, or even be modified by certain plugins.

This can lead to inconsistencies in trigger behavior across different clients or runs.

It is strongly recommended to use IDs or BNpcIDs for queries and conditions, while names should only be used in outputs (e.g., TTS / text command notifications).

  • Mathematical Expressions

    For complex filtering, mathematical expressions can be used with property expressions as placeholders.

    Examples:

    • InParty && IsT && HasStatus(0x32) (Tank in party with Sprint buff)
    • BNpcID = 18740 && roundir(Heading, 8) = 3 (Entity with BNpcID 18740 facing southwest)
    • Name == Striking Dummy && Distance < 3 (Training Dummy within 3m, using == for text equality)

Property Expressions

Property expressions specify which attributes of the retrieved entity should be returned.

Property expressions are case-insensitive.

All available property expressions are listed below:

Property Expression Description Example Requires OverlayPlugin
Address Entity address (decimal) 1801518540800
HexAddress Entity address (hex) 1A372DF6800
ID Entity ID (hex) 103CDDB2
BNpcID Entity type ID 9020
OwnerID Owner entity ID (hex) 103CDDB2
TypeName Entity type (enum) BattleNpc
Type Entity type (numeric) 2
EffectiveDistance
Distance
Effective distance 15
ObjectStatus Entity status 190
X
PosX
X coordinate 99.1
Y
PosY
Y coordinate 100.9
Z
PosZ
Z coordinate 0
XY
PosXY
XY coordinates 99.1, 100.9
XYZ
Pos
XYZ coordinates 99.1, 100.9, 0
H
Heading
Facing direction 3.14159
Radius Entity radius 7.04
ModelStatus Model status 16384
IsTargetable Targetable status 1
IsVisible Visibility status 1
HP
CurrentHP
Current HP 185050
MaxHP Max HP 221972
MP
CurrentMP
Current MP 6300
MaxMP Max MP 10000
Level Level 100
IsEnemy Enemy status 1
InCombat In combat status 0
InParty In party status 1
InAlliance In alliance status 0
IsFriend Is a friend 0 ?
WeaponID Weapon ID 4
TargetID Selected target ID (hex) 0
BNpcNameID Name ID 10376
CurrentWorldID Current world ID 102
WorldID
HomeWorldID
Original world ID 105
WorldName Original world name 0
IsCasting Casting status 1
CastType Casting type 1
CastID Cast skill ID (decimal) 3541
CastHexID Cast skill ID (hex) DD5
CastTargetID Cast target ID (hex) 103CDDB2
CastX
CastPosX
Cast ground skill X coordinate 99.1
CastY
CastPosY
Cast ground skill Y coordinate 100.9
CastZ
CastPosZ
Cast ground skill Z coordinate 0
CastPos Cast ground skill position (XYZ) 99.1, 100.9, 0
CastTime Current cast time 1.76
MaxCastTime Max cast time 2.5
StatusIDs All status IDs (decimal) 50, 3408, 2911
StatusHexIDs All status IDs (hex) 32, D50, B5F
StatusCount Number of statuses 3
Marker Entity marker (None if absent) Attack1
MarkerID Entity marker ID (-1 if absent) 0
Job
JobEN3
Job abbreviation (3 letters) DRG
JobID Job ID 22
Role Role category DPS
SubRole Sub-role category StrengthMelee
RoleID Sub-role ID 25
IsT Is tank role 0
IsH Is healer role 0
IsD Is DPS role 1
IsC Is crafting class 0
IsG Is gathering class 0
IsM Is melee DPS 0
IsR Is ranged DPS 0
IsTH IsTM IsHR IsCG Is one of the respective roles 1
JobCN Job name (Simplified Chinese) 龙骑士
JobDE Job name (German) Dragoon
JobEN Job name (English) Dragoon
JobFR Job name (French) Chevalier dragon
JobJP Job name (Japanese) 竜騎士
JobKR Job name (Korean) 용기사
JobTCN Job name (Traditional Chinese) 龍騎士
JobCN1 Job abbreviation (1 character, Simplified Chinese)
JobCN2 Job abbreviation (2 characters, Simplified Chinese) 龙骑
JobJP1 Job abbreviation (1 character, Japanese)
JobTCN1 Job abbreviation (1 character, Traditional Chinese)
JobTCN2 Job abbreviation (2 characters, Traditional Chinese) 龍騎
HasStatus(id) Checks if entity has a specific status HasStatus(0x32) => 1
StatusTimer(id) Remaining time of a status (in seconds) StatusTimer(50) => 19.81
StatusStack(id) Stack count of a specific status (extra parameter) StatusStack(50) => 0
Exist If successfully retrived 1
PluginSource None
XivPlugin
OverlayPlugin
?

Notes:

  • Various entity IDs are output in hexadecimal by default; attributes with both decimal and hex versions are differentiated by XX and HexXX.
  • Multiple attributes can be queried simultaneously, separated by commas, e.g., ${_me.X, Y, H, Address}.

Retrieving via Actions

If entity properties need to be queried frequently at a specific time point, they can be stored in variables as snapshots.

Advantages:

  • Simplifies expressions.
  • Reduces redundant queries in the entity list (querying can take up to ~5ms in large entity lists).
  • Ensures that all attributes retrieved are from the same moment in time.

Actions:

  • Dictionary Operations: Querying a Single Entity

    Check the help text of the new dictionary action in Triggernometry for details.

    The old ones (query by name/ID) are automatically converted to this new action.

  • Table Operations: Querying Multiple Entities

    Check the help text of the updated dictionary action in Triggernometry for details.

Retrieving via C# Scripts

The Triggernometry.FFXIV namespace provides the Entity class with the following functionalities:

Various Properties: Omitted, see code for details.

public static IEnumerable<Entity> GetEntities()

Automatically retrieves all entities using either the FFXIV parsing plugin or the Overlay plugin, depending on the client's plugin status.

public static IEnumerable<Entity> GetEntities(bool useOverlay)

Specifies whether to use the FFXIV parsing plugin or the Overlay plugin to retrieve all entities.

This can be combined with LINQ expressions for flexible entity filtering.

The following methods also exist in both versions, as noted above, and their differences will not be repeated.

public static Entity GetEntityByID(uint id)
public static Entity GetEntityByID(string hexID)
public static Entity GetEntityByID(uint id, bool useOverlay)
public static Entity GetEntityByID(string hexID, bool useOverlay)

Retrieves an entity by ID, using either decimal or hexadecimal format.

If no matching entity is found, returns Entity.NullEntity(), which has bool Exist set to false and all other attributes set to their default values.

public static Entity GetMyself()
public static Entity GetMyself(bool useOverlay)

Retrieves the player's own entity.

public static Entity MySnapshot
public static uint MyID
public static string MyHexID
public static IntPtr MyAddress
public static string MyName

A snapshot of the player's entity is generated each time the area changes, allowing for quick queries of attributes that do not change over time.

public Entity Snapshot()

Creates a snapshot, effectively performing a deep copy.

When retrieving entities via the FFXIV parsing plugin, their attributes may change dynamically. If needed, this method generates a fixed-attribute snapshot.

The following methods are internally used for entity queries but can also be utilized in custom C# code:

public bool TryQueryProperty(string propName, IEnumerable<string> args, out string result)
public string QueryProperty(string propName, IEnumerable<string> args)

Attempts to retrieve a specific "property" or "method" of the entity.
When querying a property (which takes no parameters), pass args = null.

This is equivalent to manually splitting a property expression and querying a single attribute.

public string QueryProperty(string rawExpression)

Retrieves a specific "property" or "method".

Unlike the previous method, this allows direct input of expressions like HasStatus(50) without separating the method name and parameters.

public string QueryProperties(string rawExpression)

Retrieves all properties or methods of the entity.

@MnFeN
Copy link
Contributor Author

MnFeN commented Jan 30, 2025

2025.1 Other updates

Read Waymark Coordinates

  • Expression:
    • ${_waymark[A].X}, or shortened as ${_wm[A].X}
    • Key:
      • by name: A B C D One Two Three Four
      • by index: 0 1 2 3 4 5 6 7
    • Property:
      • X Y Z
      • Active = 0 / 1

Bug fixes / Small adjustments

  • Case-insensitive keys:

    For dictionaries: ${d:name[key]}

    For table row/column lookups: ${tvarrl:name[key][3]}

  • Prevent main thread freeze on repo connection failure: by @NiGuangOwO

    Fixed an issue where the main thread might freeze if the plugin failed to connect to the remote repository.

  • Expressions for the newly added 0-9 digit special chars

    and renamed toxivchar to toblackchar (the old name still works)

    • ${func:toblackchar:1 2 3 a b c}
    • ${func:toblackchar(true):12} (combined digits)
    • ${func:towhitechar:1 2 3}
  • OBS actions now would not log errors when OBS is not running

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants