I create a slider controlling the duration of vaccination.

Begin micro-behaviour

CREATE-FRACTION-VACCINATED-AT-BIRTH-SLIDER

Begin NetLogo code:
substitute-text-area-for slider-variable-name the-fraction-vaccinated-at-birth               
substitute-text-area-for slider-upper-left-corner-x 625 
substitute-text-area-for slider-upper-left-corner-y 10  
substitute-text-area-for slider-lower-right-corner-x 875 
substitute-text-area-for slider-lower-right-corner-y 50  
substitute-text-area-for slider-minimum-value 0   
substitute-text-area-for slider-maximum-value 1   
substitute-text-area-for slider-increment .01 
substitute-text-area-for slider-initial-value .5  

create-slider 
  "slider-variable-name" ; the name of the parameter (a global variable)
  "slider-upper-left-corner-x" "slider-upper-left-corner-y" ; upper left corner (from the upper left corner of the applet) 
  "slider-lower-right-corner-x" "slider-lower-right-corner-y" ; lower right corner 
  "slider-minimum-value" "slider-maximum-value" ; minimum and maximum value
  "slider-increment" ; increment 
  "slider-initial-value" ; initial value
End NetLogo code

Variants

You can change the location, minimum and maximum values, increment, and initial value.

Related Micro-behaviours

POSSIBLY-VACCINATE-NEW-BORN uses the parameter the-fraction-vaccinated-at-birth defined by this slider. CREATE-FRACTION-OF-VACCINATIONS-THAT-TAKE defines the parameter the-fraction-of-vaccinations-that-take that together with the-fraction-vaccinated-at-birth determine if a newly created individual is successfully vaccinated.

CREATE-INFECTION-ODDS-SLIDER, CREATE-RATE-OF-LOSS-OF-IMMUNITY-SLIDER, CREATE-RATE-OF-RECOVERY-SLIDER and CREATE-DEATH-RATE-SLIDER create sliders also used to control vaccination models.

History

This was implemented by Ken Kahn.