-
-
Notifications
You must be signed in to change notification settings - Fork 247
File (.nlogo) and Widget Format
Here you can find information on (.nlogo) file format and widget format.
This is an informal description of the .nlogo
format.
The file format has changed and grown over the years. The version described here is the one used by NetLogo 5.x and by NetLogo Web. (NetLogo 5.x is forgiving about some deviations from this format, but the NetLogo Web model reader [from the NetLogo-Headless repo] is not.)
A conforming model file contains exactly 12 sections, separated by @#$#@#$#@
dividers.
The individual sections vary in format.
Code tab
@#$#@#$#@
Interface tab
@#$#@#$#@
Info tab
@#$#@#$#@
turtle shapes
@#$#@#$#@
NetLogo version
@#$#@#$#@
preview commands
@#$#@#$#@
System Dynamics Modeler
@#$#@#$#@
BehaviorSpace
@#$#@#$#@
HubNet client
@#$#@#$#@
link shapes
@#$#@#$#@
model settings
@#$#@#$#@
DeltaTick
This includes exactly the text that will appear in the Code tab.
This includes all the information about what appears in the Interface tab. See Widget Format
All of the text that goes in the Info tab. This tab uses markdown for display. The default is:
## WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
## HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
## HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
## THINGS TO NOTICE
(suggested things for the user to notice while running the model)
## THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
## EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
## NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
## RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
## CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
...
Turtle shapes go here. If empty, NetLogo provides the default shapes. However, once you specify a shape, it includes them all.
name-of-shape
rotatable?
number of color (its order in the editor's chooser) that is changable in the shape
Then, any number of component pieces of the shape, in a line-by-line format that's something like:
shape-type color-as-int some-bools some-numbers
NetLogo version this model was last saved in. Generally uses the form:
NetLogo <Major>.<Minor>.<Patch>
These are used to generate PNG-format preview images for the models library.
The exact format comes from JHotDraw.
BehaviorSpace experiment specifications, in XML format. (The DTD for the XML is in the Git repo somewhere.)
Widgets in the same format used for the Interface tab.
Like turtle shapes, but for links.
Right now, just whether snap-to-grid is on, it looks like. More info needed here.
relates to a now-abandoned experimental project. should be left empty.
A blank line separates widgets from each other.
The first line of the widget indicates the widget type.
The rest of the widget is fields separated by newlines (with the exception of pens, as below). Each line can be one of the following types:
- Integer - Any positive or negative, though usually positive is needed
- Double - Any positive or negative double floating point
- Reserved - Used in the past, but no longer
- Boolean
- numeric - 1/0 == true/false
- string - true/false == true/false
- T/Nil - T/NIL == true/false
- reverse - 0/1 = true/false
- Set - List of valid inputs (Boolean could be seen as a specific form of this)
- String - Any input available
- All code is escaped (new lines get turned into \n)
- When multiple strings appear on one line, they are quoted to allow spaces, in which case " characters are turned into "
- Other - as specified below
The view includes settings for the 2D view, as well as some information about the underlying world.
GRAPHICS-WINDOW
Integer // left
Integer // top
Integer // right
Integer // bottom
Reserved // USED TO BE: maxPxCor or -1
Reserved // USED TO BE: maxPyCor or -1
Double // patchsize
Reserved // shapes on, not used
Integer // font size
Reserved // hex settings
Reserved // and
Reserved // exactDraw
Reserved // not used
Boolean // wrappingAllowedInX
Boolean // wrappingAllowedInY
Reserved // thin turtle pens! Always on
Integer // minPxcor
Integer // maxPxcor
Integer // minPycor
Integer // maxPycor
0/1 // Update Mode, 0 = Continuous, 1 = Tick Based
Reserved // Update Mode repeated
Boolean // showTickCounter
String // tick counter label
Double // frame rate (defaults to 30)
BUTTON
Integer // left
Integer // top
Integer // right
Integer // bottom
String // display
String // code to execute (collapse to be inline)
T/Nil Boolean // forever?
Reserved
Reserved
String // buttonType
Reserved
String // actionkey
Reserved
Reserved
Numeric Boolean // 1 means "always enable"; 0 means "disable until ticks start" (defaults to 1)
PLOT
Integer // left
Integer // top
Integer // right
Integer // bottom
String // display
String // xaxis
String // yaxis
Double // xmin
Double // xmax
Double // ymin
Double // ymax
true/false Boolean // autoploton
true/false Boolean // legend on
String String // Two quoted code lines, defaults to "" ""
Pens are made up of one line each with space separated values, the values are of the following types
- display - quoted string
- interval - double
- mode - integer
- color - integer
- inLegend - boolean (true/false)
- setupCode - quoted, escaped, string
- updateCode - quoted, escaped, string
PENS
display interval mode color inLegend setupCode updateCode
display interval mode color inLegend setupCode updateCode
...
TEXTBOX
Integer // left
Integer // top
Integer // right
Integer // bottom
String // display
Integer // font size
Double // color
Boolean // transparent
SWITCH
Integer // left
Integer // top
Integer // right
Integer // bottom
String // display
String // varname
Inverted Boolean // on (1 is off, 0 is on)
Reserved
Reserved
CHOOSER
Integer // left
Integer // top
Integer // right
Integer // bottom
String // display
String // varname
String // choices as a list of logo objects
Integer // current choice
SLIDER
Integer // left
Integer // top
Integer // right
Integer // bottom
String // display
String // varname
String // min
String // max
Double // default
String // step
Reserved
String // units
VERTICAl/HORIZONTAL // orientation
MONITOR
Integer // left
Integer // top
Integer // right
Integer // bottom
String // display
String // source
Integer // precision
Reserve
Integer // font size
OUTPUT
Integer // left
Integer // top
Integer // right
Integer // bottom
Integer // font size
Valid input box types are "Number", "String", "String (reporter)", "String (command)", "Color" with values being of the types Double, String, String, String, Integer respectively
INPUTBOX
Integer // left
Integer // top
Integer // right
Integer // bottom
String // varname
String // value
Boolean // multiline
Reserved
String // inputboxtype
- Extensions
- NetLogo Libraries
- Controlling API
- Extensions API
- 6.0 Extension and Controlling API Transition-Guide
- Optimizing NetLogo Runs
- Setting English as the Default Language when Running NetLogo
- Unofficial Features
- Advanced Installation
- Optimization List
- Java System Properties and how to use them
- NetLogo on ARM Devices
- Multiple Views via HubNet
- Branches
- Building
- Tests
- Windows Setup
- Continuous Integration
- Draft: How to Help
- NetLogo Project Ideas
- Syntax Highlighting
- Building with IntelliJ
- Code Formatting
- Localization
- File (.nlogo) and Widget Format
- Benchmarking
- Releasing
- Preparing the Models Library for Release
- Documentation
- NetLogo Bundled Java Versions
- JOGL
- Plugins API
- Architecture
- LazyAgentset
- Model Runs and Review Tab
- Model Runs: To Do and Code Overview
- Notes on in Radius
- Archived Branches
- The nlogox format
- Touch API Proposal
- Why isn't NetLogo "Parallel"?
- Potential Speedups
- Tortoise
- SimServer, WebStart, and NetLogo in Classrooms