title: netlogo: how to make turtles stop for a set number of ticks then continue
body: <p>I'm trying to create a model where turtles walk randomly (but with a tendency for forward movement) until they land on a yellow coloured patch which represents a baited object.</p>
  
  <p>When a turtle lands on one of the yellow patches, I'd like it to stop on that patch and stay there for 15 ticks whilst it 'investigates' the bait.</p>
  
  <p>After 15 ticks have elapsed I want the turtles to continue moving as usual until they encounter another yellow patch.</p>
  
  <p>I've attempted to modify parts of this parked card model in the netlogo modelling commons but couldn't really make sense of it (I'm new to netlogo)
  <a href="http://modelingcommons.org/browse/one_model/3205#model_tabs_browse_procedures" rel="nofollow noreferrer">http://modelingcommons.org/browse/one_model/3205#model_tabs_browse_procedures</a></p>
  
  <p>I've also tried implementing a count-down timer as described in this thread
  <a href="https://stackoverflow.com/questions/4296818/how-can-one-create-a-countdown-timer-in-netlogo/8933914#8933914">How can one create a countdown timer in NetLogo?</a></p>
  
  <p>However I receive a runtime error 'Only the observer can ASK the set of all turtles' when I try to run the simulation. Can anyone tell me where I'm going wrong? Probably several places! Thanks.</p>
  
  <p>Here's the code that's causing the runtime error:</p>
  
  <pre><code>turtles-own [count-down]
  
  to setup 
  clear-all
  ask patches with [count neighbors != 8]
  [set pcolor blue]                   
  
  create-turtles 20
  ask turtles 
   [setxy random-xcor random-ycor 
   pen-down]   
  
  ask n-of 20 patches
  [ set pcolor yellow ]                   
  
  reset-ticks
  end
  
  to go
   move-turtles
   tick
   if ticks &gt;= 720 [stop]
  
   end
  
  
  to move-turtles
  ask turtles
    [ ifelse pcolor != yellow
    [continue]
    [stay]
    ]
   end
  
   to continue
  ask turtles   
  [rt -90 + random 181]
  ask turtles
  [ifelse [pcolor] of patch-ahead 1 = blue [ lt random-float 360 ]   
  [fd 1]  
  ]
  end
  
  to stay
  ask turtles 
  [
  setup-timer
  decrement-timer
  if timer-expired? [continue]
  ]
  end
  
  to setup-timer
  set count-down 15
  end
  
  to decrement-timer
  set count-down count-down - 1
  end
  
  to-report timer-expired?
  report ( count-down &lt;= 0 )
  end
  </code></pre>