Overview
Conditions allow you to change display properties dynamically based on trigger states, game conditions, or custom logic. They’re perfect for color-coding, showing/hiding elements, and responsive UI behavior.
Conditions are evaluated and applied efficiently using Conditions.lua, checking only when relevant state changes occur.
Basic Condition
{
conditions = {
{
check = {
trigger = 1 ,
variable = "value" ,
op = "<" ,
value = 30
},
changes = {
{
property = "color" ,
value = { 1 , 0 , 0 , 1 } // Red when low
}
}
}
}
}
Condition Structure
Simple Check
AND Logic
OR Logic
{
check = {
trigger = 1 , // Which trigger
variable = "stacks" , // State property
op = ">=" , // Operator
value = 5 // Comparison value
},
changes = { // What to change
{ property = "color" , value = { 0 , 1 , 0 , 1 }}
}
}
{
check = {
trigger = - 2 , // Logical group
variable = "AND" ,
checks = {
{ trigger = 1 , variable = "value" , op = "<" , value = 50 },
{ trigger = 1 , variable = "stacks" , op = ">=" , value = 3 }
}
},
changes = {{ property = "color" , value = { 1 , 1 , 0 , 1 }}}
}
{
check = {
trigger = - 2 ,
variable = "OR" ,
checks = {
{ trigger = 1 , variable = "value" , op = "<" , value = 20 },
{ trigger = 2 , variable = "show" , op = "==" , value = 1 }
}
},
changes = {{ property = "alpha" , value = 1.0 }}
}
Comparison Operators
Operator Description Types ==Equals All <Less than number, timer <=Less than or equal number, timer >Greater than number, timer >=Greater than or equal number, timer find('%s')Contains substring string match('%s')Regex match string
Variable Types
Number Variables
{
check = {
variable = "value" ,
op = "<" ,
value = 1000
}
}
Common number variables:
value - Current value
total - Maximum value
stacks - Stack count
matchCount - Number of matches
unitCount - Number of units affected
Timer Variables
{
check = {
variable = "expirationTime" ,
op = "<" ,
value = 5 // Less than 5 seconds remaining
}
}
Timer variables:
expirationTime - When timer expires
duration - Total duration
initialTime - When started
refreshTime - When refreshed
Timer comparisons use remaining time, not raw timestamps.
Boolean Variables
{
check = {
variable = "show" ,
op = "==" ,
value = 1 // or 0 for false
}
}
String Variables
{
check = {
variable = "name" ,
op = "find('%s')" ,
value = "Shield"
}
}
Global Conditions
Check game-wide states:
{
check = {
trigger = - 1 , // Global trigger
variable = "incombat" ,
op = "==" ,
value = 1
}
}
Available Global Conditions
In Combat incombat - Player in combat
Has Target hastarget - Player has target
Attackable Target attackabletarget - Target can be attacked
Range Check rangecheck - Custom range checking
Custom Check
{
check = {
trigger = - 1 ,
variable = "customcheck" ,
value = [[
function(state)
local health = UnitHealth("player")
return health < 10000
end
]]
}
}
Property Changes
Visual Properties
{
property = "color" ,
value = { 1 , 0 , 0 , 1 } // RGBA
}
Text Properties
{
property = "displayText" ,
value = "WARNING: %n"
}
{
property = "fontSize" ,
value = 20
}
Icon Properties
{
property = "desaturate" ,
value = true
}
{
property = "displayIcon" ,
value = "Interface \\\\ Icons \\\\ Spell_Holy_PowerWordShield"
}
Progress Properties
{
property = "inverse" ,
value = true
}
{
property = "orientation" ,
value = "VERTICAL"
}
Linked Conditions
Chain conditions with else-if logic:
conditions = {
{
// First condition
check = { trigger = 1 , variable = "value" , op = "<" , value = 20 },
changes = {{ property = "color" , value = { 1 , 0 , 0 , 1 }}} // Red
},
{
linked = true , // Else - if
check = { trigger = 1 , variable = "value" , op = "<" , value = 50 },
changes = {{ property = "color" , value = { 1 , 1 , 0 , 1 }}} // Yellow
},
{
linked = true , // Else - if
check = { trigger = 1 , variable = "value" , op = ">=" , value = 50 },
changes = {{ property = "color" , value = { 0 , 1 , 0 , 1 }}} // Green
}
}
Linked conditions create if-elseif chains. Only the first matching condition applies.
Common Patterns
Health Color Coding
conditions = {
{
check = { trigger = 1 , variable = "value" , op = "<" , value = 30 },
changes = {{ property = "color" , value = { 1 , 0 , 0 , 1 }}} // Red < 30 %
},
{
linked = true ,
check = { trigger = 1 , variable = "value" , op = "<" , value = 60 },
changes = {{ property = "color" , value = { 1 , 1 , 0 , 1 }}} // Yellow < 60 %
},
{
linked = true ,
check = { trigger = 1 , variable = "value" , op = ">=" , value = 60 },
changes = {{ property = "color" , value = { 0 , 1 , 0 , 1 }}} // Green >= 60 %
}
}
Timer Warning
{
check = {
trigger = 1 ,
variable = "expirationTime" ,
op = "<" ,
value = 5 // < 5 seconds
},
changes = {
{ property = "color" , value = { 1 , 0 , 0 , 1 }},
{ property = "fontSize" , value = 20 }
}
}
Stack-Based Size
{
check = {
trigger = 1 ,
variable = "stacks" ,
op = ">=" ,
value = 5
},
changes = {
{ property = "width" , value = 80 },
{ property = "height" , value = 80 }
}
}
Desaturate on Cooldown
{
check = {
trigger = 1 ,
variable = "show" ,
op = "==" ,
value = 1
},
changes = {
{ property = "desaturate" , value = true }
}
}
Show Text for Stacks
{
check = {
trigger = 1 ,
variable = "stacks" ,
op = ">" ,
value = 1
},
changes = {
{ property = "displayText" , value = "%n (%s)" }
}
}
Advanced Features
Scheduled Rechecks
Conditions auto-schedule rechecks for timer-based checks:
// Internal : Automatically scheduled
if nextTime and nextTime >= now then
Private . ExecEnv . ScheduleConditionCheck ( nextTime , uid , cloneId )
end
Sub-Region Properties
Modify sub-region properties:
{
property = "sub.1.text_color" , // Sub - region 1 's text color
value = { 1 , 0 , 0 , 1 }
}
Progress Source Changes
{
property = "progressSource" ,
value = { 2 , "auto" , "value" , "total" } // Switch to trigger 2
}
Custom Code Properties
Some properties use custom code:
{
property = "customcode" ,
value = {
custom = [[
region:SetSize(100, 100)
region:SetAlpha(0.5)
]]
}
}
Condition Evaluation
Conditions are evaluated when:
Trigger state changes
Timer thresholds are reached
Global game state changes
Manual recheck triggered
// Internal evaluation
function checkConditions ( region , hideRegion )
local state = region . states
// Check each condition
for conditionNumber , condition in ipairs ( data . conditions ) do
if ( check matches ) then
// Apply changes
region : SetProperty ( property , value )
end
end
end
Conditions only evaluate when relevant states change. Avoid custom checks that don’t depend on state.
Timer-based conditions schedule future rechecks. Many timer conditions may create overhead.
Property changes trigger redraws. Avoid conditions that change frequently.
Troubleshooting
Verify trigger number matches
Check variable name is correct
Ensure operator and value are appropriate
Check if linked condition is blocking it
Verify trigger provides that property
Conditions evaluate top-to-bottom
Use linked conditions for if-elseif logic
First matching condition wins for linked chains
Ensure comparison value is in seconds
Check trigger provides expirationTime
Verify trigger has timed progress
Best Practices
Condition Types Reference
Type Description Example Variables numberNumeric comparison value, stacks, matchCount timerTime-based check expirationTime, duration elapsedTimerElapsed time initialTime, refreshTime boolBoolean check show, active, paused stringString matching name, unitName, casterName selectList selection debuffClass, unit customcheckCustom Lua Any custom logic alwaystrueAlways matches N/A
Triggers What generates the states
Animations Trigger animations conditionally
Custom Code Advanced condition logic