Reputation: 11
please I have a notepad file saved with .nls, how do I call it to my NetLogo ... anybody help me with the code
globals [
letter_E
];
for declaring global var
patches-own [number] ;patch var
to setup clear-all setup-patches reset-ticks end
ask patches [ set plabel = set-pcolor = black set-patch-size = 10 ]
to setup-letter_E
;set your cordinates
ask (patch-set patch 0 0) [set pcolor 0]
ask (patch-set patch 0 1) [set pcolor 1]
ask (patch-set patch 1 1) [set pcolor 2]
ask (patch-set patch 1 2) [set pcolor 3]
ask (patch-set patch 2 2) [set pcolor 4]
Upvotes: 1
Views: 159
Reputation: 4168
You have two options. You can copy and paste the code from the .nls file to the Code tab of the NetLogo model, or you can use the __includes
feature of NetLogo. If your .nls file is named (for instance) mycode.nls
, you can put at the top of your NetLogo model code
__includes["mycode.nls"]
(There are two underscores in front of "includes".) If you check out __inlcudes
in the NetLogo dictionary, you will see that you can include more than one .nls file. The files should be in the same directory as your model. When you do that, the NetLogo Code tab will have a drop-down list of "Included Files" and you will find "mycode.nls" there.
All that said, the code you have in the .nls file will not run as is. There are a number of errors. But that is a different question.
Upvotes: 2