NetLogo allows users to write new commands and reporters in Java and other languages and use them in their models. This section of the User Manual introduces this facility and shows how to use an extension in your model once you have obtained or made one.
Extensions created by members of the NetLogo community are available from https://github.com/NetLogo/NetLogo/wiki/Extensions.
For information on creating your own extensions, go here.
To use an extension in a model, add the extensions
keyword at the
beginning of the Code tab, before declaring any breeds or variables.
After extensions
comes a list of extension names in square brackets. For example:
extensions [sound speech]
Using extensions
tells NetLogo to find and open the specified extension and makes the
custom commands and reporters found in the extension available to the
current model. You can use these commands and reporters just as if
they were built-in NetLogo primitives.
NetLogo will look for extensions in several places:
/Applications/NetLogo 6.0.1/extensions
C:\Program Files\NetLogo 6.0.1\app\extensions
C:\Program Files (x86)\NetLogo 6.0.1\app\extensions
app/extensions
subdirectory of the NetLogo directory extracted from the installation .tgz
Each NetLogo extension consists of a folder with the same name as the
extension, entirely in lower case. This folder must contain a JAR
file with the same name as the folder. For example the sound
extension is stored in a folder called sound
with a file
inside called sound.jar
.
To install a NetLogo extension for use by any model, put the extension's folder in the NetLogo extensions directory. Or, you can just keep the extension's folder in the same folder as the model that uses it.
Some extensions depend on additional files. These files will be in the extension's folder along with the JAR file. The folder may also contain other files such as documentation and example models.