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.
| Example | Sends 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
| Condition | True when |
|---|---|
CRASH | A crash is currently detected |
NOCRASH | No crash is currently active |
INCIDENT | An incident is currently detected |
NOINCIDENT | No incident is currently active |
Gap Conditions
Replace N with any number of seconds. Operators: < > <= >=
| Condition | True when |
|---|---|
GAPHEAD<N or GAPHEAD1<N | Gap to 1st car ahead is less than N seconds |
GAPHEAD2<N | Gap to 2nd car ahead is less than N seconds |
GAPHEAD3<N | Gap to 3rd car ahead is less than N seconds |
GAPBEHIND<N or GAPBEHIND1<N | Gap to 1st car behind is less than N seconds |
GAPBEHIND2<N | Gap to 2nd car behind is less than N seconds |
GAPBEHIND3<N | Gap to 3rd car behind is less than N seconds |
Flag Condition
| Condition | True when |
|---|---|
FLAG=Yellow | Current flag is Yellow / Caution |
FLAG=Green | Current flag is Green (racing) |
FLAG=Red | Current flag is Red |
FLAG=White | Current flag is White (final lap) |
FLAG=Checkered | Current flag is Checkered |
Practical Examples
Notify close cars when pitting
| Field | Content |
|---|---|
| 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
| Field | Content |
|---|---|
| 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.