2

I had problem with ticker in netlogo. I want to reset ticker to zero. But when you reset ticker with "reset-tickers" command, all the variables, plots and ... will reset to zero too, but this is not pleasant for me. I want just reset the ticker and set it to zero without resetting other variables and .... How can I do that?

Thanks

1 Answers1

3

The reset-ticks primitive does, indeed, set up and update all plots. It does not, however, reset all variables (clear-all does that).

In any case, you should see ticks as representing time in your model. And time cannot flow backward. Resetting ticks will always be the equivalent of "starting over" with a brand new run of your model.

If you want some counter that you can reset to zero without affecting anything else, tough, it's easy to make one yourself.

First, declare a global variable:

globals [ my-counter ]

Somewhere in your setup procedure, set that variable to 0:

set my-counter 0

Somewhere in your go procedure, increment it:

set my-counter my-counter + 1

And whenever you want to "reset" your counter, just set it to 0 again like you did at setup:

set my-counter 0
Nicolas Payette
  • 14,847
  • 1
  • 27
  • 37
  • Also, you can use `plotxy` to plot points that are not removed by `reset-ticks`, but I second the strategy of using a separate global. – Bryan Head Feb 12 '14 at 05:31
  • `reset-ticks` doesn't clear plots or remove points. (I'm not sure if anyone actually has a misunderstanding here, or it's just a case of fuzzy phrasing.) It does run a plot's setup commands, followed by its go commands, but it would be highly unusual (though certainly possible) for those commands to contain anything that clears, resets, or removes. – Seth Tisue Feb 13 '14 at 01:25