Macro APITriggers
Enemy Spotted
Chooses whether to engage, drink a potion, or avoid a spotted enemy.
- Category
- Combat
- Runs when
- An enemy appears.
- Summary
- Chooses whether to engage, drink a potion, or avoid a spotted enemy.
- Version
- 1
Events
- combat-start
Lua Example
if ctx.combat.currentLifeRatio < 0.3 and ctx.combat.hasLifeConsumable then
return combat.drinkPotion()
end
return combat.attack("lowestLife")ctx Fields
| Trigger | Path | Type | Label | Description |
|---|---|---|---|---|
| Enemy Spotted | ctx.combat.currentLifeRatio | number | Life ratio | Current life divided by maximum life. |
| Enemy Spotted | ctx.combat.hasLifeConsumable | boolean | Has life consumable | Whether a life-restoring consumable is available. |
| Enemy Spotted | ctx.player.level | number | Player level | The player level used for this macro run. |
| Enemy Spotted | ctx.player.currencyCopper | number | Currency | The player currency carried in copper. |
| Enemy Spotted | ctx.player.bag.usedSlots | number | Bag used | The number of backpack slots currently occupied. |
| Enemy Spotted | ctx.player.bag.maxSlots | number | Bag capacity | The current backpack capacity including equipped bag bonuses. |
| Enemy Spotted | ctx.player.bag.freeSlots | number | Bag free | The number of free backpack slots remaining. |
| Enemy Spotted | ctx.player.derivedStats.maxLife | number | Derived stat | A derived stat value; other stat keys are available beside maxLife. |
| Enemy Spotted | ctx.player.equipment.mainHand.itemDefinitionKey | string | Equipped item | An equipped item definition key. Replace mainHand with another equipment slot as needed. |
| Enemy Spotted | ctx.player.equipment.mainHand.rarity | string | Equipped item rarity | The rarity of an equipped item. |
| Enemy Spotted | ctx.player.equipment.mainHand.itemLevel | number | Equipped item level | The required level of an equipped item. |
| Enemy Spotted | ctx.player.equipment.mainHand.dropLevel | number | Equipped drop level | The drop level used to generate an equipped item. |
| Enemy Spotted | ctx.player.equipment.mainHand.stats.maxLife | number | Equipped item stat | A stat contribution from an equipped item; other stat keys are available beside maxLife. |
| Enemy Spotted | ctx.player.equipment.mainHand.affixes[].key | string | Equipped affix | A rolled affix key on an equipped item. |
Blocks
| Block | Category | Summary |
|---|---|---|
| Attack | Combat | Returns attack to the active Combat Profile. |
| Drink Potion | Combat | Returns drink potion to the active Combat Profile. |
| Avoid | Combat | Returns avoid to the active Combat Profile. |
| Continue | Flow | Returns continue to the Storyteller. |
| Pause | Flow | Returns pause to the Storyteller. |