1

I want to delete only turtle pen lines from a halfway point in a model run. The "clear-drawing" primitive seems to achieve that, but my problem is that I can't run it directly from an agent, or use "ask observer [clear-drawing]". Is there a way to trigger this observer command from an agent context (I expect not), or is there another way of erasing turtle pen lines? My solution to re-draw using pens having the background color is rubbish.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
grrover
  • 13
  • 3
  • I am not sure I understand, but does this do what you want (in the go procedure) - `if ticks = 100 [ clear-drawing ]`? Or if you want to be able to do it manually, have a button with the command `clear-drawing`. – JenB Dec 10 '15 at 13:06

1 Answers1

2

Instead of redrawing using the background color, use pen-erase. If that's equally “rubbish”, perhaps you want something more like the answers here? NetLogo turtles leaving a trail that fades with time

About clear-drawing being observer-only though, that seems like it shouldn't be too hard to work around, something like:

to go
  let clear? false
  ask turtles [
    ...
    if ... [
      set clear? true
    ]
    ...
  ]
  if clear? [ clear-drawing ]
  tick
end
Community
  • 1
  • 1
Seth Tisue
  • 29,985
  • 11
  • 82
  • 149