Skip to main content

Using Conditionals in Messages

Conditional Messages

iReporter supports conditional message lines using a simple bracket syntax. Place a condition in parentheses at the start of any message field — if the condition is false at press time, that line is silently skipped and nothing is sent for it.

Syntax

(condition)message text here

Everything after the closing ) is sent only when the condition is true. No closing tag needed — the condition applies to the whole line.

Example

(GAPBEHIND1<2)/msg {CARBEHIND1} Car {CAR#} is pitting this lap!

This sends a private message to the car immediately behind only if it is within 2 seconds. If the gap is greater the line is skipped entirely and nothing is sent.

AND and OR

Combine multiple conditions on the one line using && (AND) or || (OR). AND is evaluated before OR.

ExampleSends when
(CRASH && GAPBEHIND1<5)/rc Contact near traffic!A crash is active AND car 1 behind is within 5s
(CRASH || INCIDENT)/rc Incident detected!A crash OR an incident is currently active
(FLAG=Yellow && GAPHEAD<3)/rc Yellow — tight ahead!Yellow flag AND less than 3s to car ahead

You can also write AND and OR in plain English instead of && and ||.

Available Conditions

Crash and Incident

ConditionTrue when
CRASHA crash is currently detected
NOCRASHNo crash is currently active
INCIDENTAn incident is currently detected
NOINCIDENTNo incident is currently active

Gap Conditions

Replace N with any number of seconds. Operators: < > <= >=

ConditionTrue when
GAPHEAD<N or GAPHEAD1<NGap to 1st car ahead is less than N seconds
GAPHEAD2<NGap to 2nd car ahead is less than N seconds
GAPHEAD3<NGap to 3rd car ahead is less than N seconds
GAPBEHIND<N or GAPBEHIND1<NGap to 1st car behind is less than N seconds
GAPBEHIND2<NGap to 2nd car behind is less than N seconds
GAPBEHIND3<NGap to 3rd car behind is less than N seconds

Flag Condition

ConditionTrue when
FLAG=YellowCurrent flag is Yellow / Caution
FLAG=GreenCurrent flag is Green (racing)
FLAG=RedCurrent flag is Red
FLAG=WhiteCurrent flag is White (final lap)
FLAG=CheckeredCurrent flag is Checkered

Practical Examples

Notify close cars when pitting

FieldContent
Message 1/rc Car {CAR#}, {DRIVER} Pitting this LAP
Message 2(GAPBEHIND1<2)/msg {CARBEHIND1} Car {CAR#} pitting this LAP!
Message 3(GAPBEHIND2<3)/msg {CARBEHIND2} Car {CAR#} pitting this LAP!

Message 1 always fires. Messages 2 and 3 fire only when the cars behind are within the gap threshold — each sends a separate private message.

Flag-aware status

FieldContent
Message 1(FLAG=Yellow)/rc Yellow flag — Car {CAR#} Lap {CARLAP} holding position
Message 2(FLAG=Green)/rc Racing — Car {CAR#} Lap {CARLAP}

Combined condition

(CRASH && GAPBEHIND1<5)/rc Contact AND close traffic behind — Car {CARBEHIND1} at risk

Using the Variable Picker

Type ( in any message box to open the variable picker and browse all available conditions. AND / OR examples are included at the bottom of the list.

Backward Compatibility

The older {IF:condition}text{ENDIF} syntax is still fully supported for any messages you have already saved.