As part of a class I am teaching, I wanted to use the “Peppered Moth” model as an illustration of evolution as well as how the students might alter code to run their own ABMs. The Peppered Moth model runs perfectly on the web version of NetLogo, and it runs on the desktop version if I open it from the Models Library, but if I copy the code into a new file and check it, I receive the error that “Nothing named SPEED has been defined.” Is there some hidden code that I am somehow not capturing? Thanks so much.
Hi @ddion,
I’m glad you came here to ask this question, and welcome to the Forum!
In the original model, speed is defined by the speed
slider on the interface. So, if you are trying to copy the code to a new model, you either need to
- make the same sliders on the interface (this is the recommended way if you want to play around with different values)
- or define those variables as
globals
in the code tab and then set their values in thesetup
procedure.
Out of curiousity, what’s the reason you wanted to copy the code to a new file to check it?
Thanks for the welcome, and for the helpful response.
My reason for copying the code was mainly to make sure the desktop version of NetLogo I had just installed was working properly. I noticed that some of the models in the library can’t be modified using the web browser, and I also had some hopes of creating my own models. You’ve made all of that easier, thanks.
1 Like