POSSIBLE-INFECTION
Begin NetLogo code:do-if my-state = "susceptible"
; if I'm susceptible
[do-with-probability the-infection-odds
; and the infection occurs
[add-behaviour SET-STATE-INFECTED]]
End NetLogo code
This uses SET-STATE-INFECTED to conditionally set my state to infected. RANDOM-ENCOUNTER uses this micro-behaviour. CREATE-INFECTION-ODDS-SLIDER sets the the-infection-odds variable .
When my-state is "susceptible" then the odds of getting the infection are used to determine if I'm infected.
This was implemented by Ken Kahn.