I'm a new user of NetLogo (5.0.5) and I receive error messages when I try to do pretty basic things. In particular I get
Nothing named x has been defined
when I try to define/use various agentsets. For instance
show turtles with [color=red]
show turtles with [who<10]
ask turtles [set friends turtles with [color=red]]
generate this message (where friends is a turtle variable). However,
ask turtles [set friends turtles in-radius 7]
is ok. So it might have to do with 'with'. I'm not sure what do do here. I was following along Jose Vidal's excellent tutorial
https://www.youtube.com/watch?v=k5RMdrbJXpM&list=PLSx7bGPy9gbFCWOQ6bAb_4ASLIrblXhqP
and everything was working until i tried
show cats with [color=red]
which generated the above error-message. Can anyone help with this?
I haven't found anything about this anywhere but since I'm new there might be resources that do not show up on google (or here) that I've missed.
Unlike some other programming languages, NetLogo doesn't allow you to smash arithmetic and comparison operators up against identifiers; they have to be separated. So you need to write color = red, with the spaces, instead of color=red, and who < 10 instead of who<10. (If you smash them together, NetLogo thinks the whole thing is a single name for something.)
You can smash brackets [] and parentheses () up against other things without spaces, but not other punctuation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With