I run any NetLogo command. I can be used to add a new reporter or command to NetLogo.

Begin micro-behaviour


Begin NetLogo code:
substitute-text-area-for code to-report total-population\n  report count all-individuals\nend
End NetLogo code


Any NetLogo code can be placed in the text area. E.g.

watch any-of-kind "Person"
If the code begins with to or to-report then it will be added to the commands and reporters that other micro-behaviours can use.

How this works

If the code begins with to or to-report this adds to the generated NetLogo file a new NetLogo reporter or command that can be used by any micro-behaviour. In this example it defines total-population that computes the number of individuals in the model. Otherwise this can be any code NetLogo command to be run by the agent with this behaviour.


This was implemented by Ken Kahn.