Using Conditionals in Messages
WhatConditional isMessages
iReporter supports conditional message lines using the (IF:condition) syntax. When placed at the very start of a Conditional?
A conditional is a way of saying "only include this part of the message if a certain situation is true." This lets a single button do different things depending on what is happening in the race at that moment — without you having to think about it.
Think of it like this: imagine you have a button labelled Contact Report. If iReporter has detected a crash, you want the message to include the car number and driver name. If there is no active crash, you want a more general message instead. Conditionals handle that automatically.
The Basic Format
A conditional block looks like this:
{IF:CONDITION}The text to show ifline, the condition istrue{ENDIF}
{IF:CONDITION}evaluated at the moment the button is pressed —theifopeningittag.isReplacefalse,CONDITIONthatwithlineoneisofsilently skipped and nothing is sent.Syntax
(IF:condition)message text here
The condition goes inside the
conditionsparentheseslisteddirectlybelow.TheaftertextIF:.betweenEverything after thetagsclosing—)this text only appears inis the message that will be sent if the condition is true.ItNocanclosingincludetagvariablesislike {CRASHCAR} or {DRIVER}.{ENDIF}needed — theclosingconditiontag.appliesAlways required atto theendwholeofline.everyExample
conditional(IF:GAPBEHIND1<2)/msg
block.
Important:This Conditionalssends area processedprivate beforemessage to the messagecar immediately behind only if it is sent,within so2 seconds. If the recipientgap seesis onlygreater than 2 seconds the finalline resultis —skipped neverentirely.
Available Conditions
Crash and Incident
| Condition |
|---|
CRASH(IF:CRASH)A crash NOCRASH(IF:NOCRASH)No crash is currently active
INCIDENT(IF:INCIDENT)An incident NOINCIDENT(IF:NOINCIDENT)No incident is currently active
FlagGap Conditions
Replace the 5 with any number (seconds). Operators supported: < > <= >=
| Condition |
|---|
FLAG=Green(IF:GAPHEAD<5)FLAG=YellowFLAG=RedFLAG=BlackFLAG=CheckeredGap Conditions
These check the time gap (in seconds) to cars around you.
|
GAPHEAD>10(IF:GAPHEAD2<5)GAPHEAD<=10GAPHEAD>=10GAPHEAD2<5(IF:GAPHEAD3<55)(IF:GAPBEHIND<55)GAPBEHIND>5(IF:GAPBEHIND2<5)GAPBEHIND2<5(IF:GAPBEHIND3<55)LapFlag ConditionsCondition
| Condition |
|---|
CARLAP>5(IF:FLAG=Yellow)CARLAP<10(IF:FLAG=Green)CARLAP=1(IF:FLAG=Red)(IF:FLAG=White)Current flag is White (final lap)
(IF:FLAG=Checkered)Current flag is Checkered
Practical Examples
Notify close cars when pitting
Message 1 always fires. Messages 2 and 3 fire only when the cars behind are on lap 1
CRASHLAP>5Simple Examples
Example 1 — Show crash details only if a crash is active
{IF:CRASH}Contact: Car #{CRASHCAR} ({CRASHNAME}) — {CRASHDIR}{ENDIF}
If a crash is active → message reads: Contact: Car #42 (John Smith) — aheadIf no crash is active →within the messagegap isthreshold.
Example 2 — Different message depending on crashFlag-aware status report
UseMessage two1: conditional(IF:FLAG=Yellow)/rc blocksYellow back-to-back for an either/or result:
{IF:CRASH}Contact reportedflag — Car#{CRASHCAR} involved{ENDIF}{IF:NOCRASH}No active contact detected{ENDIF}
If crash active → Contact reported — Car #42 involvedIf no crash → No active contact detected
Example 3 — Yellow flag message
{IF:FLAG=Yellow}Yellow flag showing — please slow down{ENDIF}{IF:FLAG=Green}Track is green — racing{ENDIF}
Example 4 — Close traffic warning
Alert when there is a car within 3 seconds ahead:
{IF:GAPHEAD<3}Close traffic ahead — Car #{CARAHEAD1} is only {GAPHEAD1}s in front{ENDIF}
Example 5 — Combine regular text with a conditional
You can mix normal text with conditional sections in the same message:
Race Control Update — Car #{CAR#} Lap {CARLAP}{holding position
Message 2:(IF:CRASH}—FLAG=Green)/rcCONTACT: Car #{CRASHCAR}{ENDIF}
If crash active → Race Control UpdateRacing — Car #7{CAR#} Lap 12{CARLAP}
Note on the older {{}IF{}} syntax
Earlier versions of iReporter used {IF:condition}text{ENDIF}. This syntax is still supported for any messages you have already saved, but the new (IF:condition) form is recommended for all new messages — CONTACT:it Caris #42Ifshorter, noeasier crashto →read, Race Control Update — Car #7 Lap 12
Achieving AND / OR Logic
iReporterand does not haverequire a built-inclosing AND or OR keyword, but you can achieve the same result using the three message lines available on each button.tag.
Simulating OR — use multiple message lines
If you want to send a message when EITHER a crash OR an incident is active, put each case on its own message line:
Line 1: {IF:CRASH}Crash: Car #{CRASHCAR} ({CRASHNAME}){ENDIF} Line 2: {IF:INCIDENT}Incident: Car #{INCCAR} ({INCNAME}){ENDIF}
Both lines are evaluated independently. If a crash is active, line 1 sends. If an incident is active, line 2 sends. If both are active (which cannot normally happen), both send.
Simulating AND — nest your most specific condition first
If you only want a message when both conditions are true — for example, a crash AND the gap to the car ahead is very small — use the crash fallback field on the button (which only triggers when a crash is active) and add a gap condition inside it:
{IF:GAPHEAD<5}URGENT: Contact at close quarters — Car #{CRASHCAR} within {GAPHEAD1}s{ENDIF}
Because the fallback only runs when a crash is already active, this message only appears when BOTH conditions are true: crash active AND gap less than 5 seconds.
Tips for Non-Technical Users
Always close your blocks.Every{IF:...}must have a matching{ENDIF}. If you forget it, the message may not send correctly.Spelling matters.Conditions are not case-sensitive for flag names (Yellow, YELLOW, and yellow all work), but the structure must be exact — no spaces inside the curly braces.Test before race day.Use theTEST FIREbutton in the settings panel to see exactly what message will be sent under current conditions. Try it with and without an active crash to confirm both paths work correctly.Keep it simple.A message with one or two conditionals is much easier to read and debug than a complex chain. If you need very different messages for very different situations, consider using separate buttons.Variables work inside conditionals.Any variable like{CRASHCAR},{DRIVER}, or{GAPHEAD1}can be used inside a conditional block and will be filled in with live data when the button is pressed.
Full Working Message Examples
Race Control — Contact Report button
Message 1: /rc Race Control — {IF:CRASH}Contact: Car #{CRASHCAR} ({CRASHNAME}) Lap {CRASHLAP}{ENDIF}{IF:NOCRASH}Contact reported — no car data available{ENDIF} Message 2: {IF:CRASH}/rc Involved car was {CRASHDIR} — please review{ENDIF}
Status Update button — works at any time
Message 1: /rc Car #{CAR#} ({DRIVER}) — Lap {CARLAP} — {IF:FLAG=Yellow}Yellow Flag{ENDIF}{IF:FLAG=Green}Green Flag{ENDIF}{IF:FLAG=Red}Red Flag{ENDIF}
Close Battle Alert
Message 1: {IF:GAPHEAD<3}CLOSE: {CARAHEAD1} is {GAPHEAD1}s ahead{ENDIF} Message 2: {IF:GAPBEHIND<3}CLOSE: {CARBEHIND1} is {GAPBEHIND1}s behind{ENDIF}