Unexpected paint behavior - netlogo

I want to use a paint command but think have a file problem, not a code problem. This is the code:
to color-white
if mouse-down?
[ask patch mouse-xcor mouse-ycor
[ set pcolor white]]
end
It simply paints in real time when the left mouse button is pushed and pointer passes over the screen. The code works if its written in a new Netlogo session. But if it's used in this file:
paint-white.nlogo
paint won't appear in real time. Please help.

I'd suggest adding a call to display in your code whenever you want the display to update. That's how the models in the NetLogo Models Library do it.
"continuous" view updates is a somewhat reasonable alternative, but it involves giving up all control of when view updates occur.

Problem solved: changed view updates from "on ticks" to "continuous".

Related

3d object error once the model start running

i am trying to use one of the 3d Objects in Anylogic , once i drag the item , it doesn't show the real shape of the object upon running and it shows the following enter image description here
check on the resources section of your project if they are actually there... sometimes you move the .alp somewhere else and you lose the location of the objects... or sometimes AnyLogic just makes our life difficult
if you have issues with the elements, you will see a red or grey circle instead of green.

Accelerating BehaviorSpace runs using speed slider?

My Netlogo 6.0.4 model generates custom output using csv commands I coded myself. I have 192 experiments to run (see image below). They proceed using partial ticks equal to the user-supplied "timestep" size. In order to speed up execution, I de-selected "Update View" and "Update plots and monitors". The BehaviorSpace window also includes a slider currently set to "Normal Speed." Question: Since updates are off, does the speed slider have any effect on computation speed? Based on the user manual, I would think not, but despite de-selecting "Update View" I can still move the slider, which suggests to me that it may still be possible.
The speed slider speeds up models by skipping some view updates. So if you uncheck the "Update view" checkbox, you've already done the maximum, the speed slider will not help further.
It would make sense for the speed slider to be grayed out when "Update view" is checked. Not sure why we never did that. (Never thought of it? Or just never got around to it?)

In NetLogo how do you get rid of the World View

The title says it all. I'm building an application with switches, sliders, and plots but no 2-dimensional display. Is there a way to delete the World display? Of course I can shrink it down, and I can set all the turtles to hidden?, but I can't find a way to get rid of it entirely. Thanks.
As Nicolas says, there is no official way to do this.
The workaround I would suggest is to set max-pxcor to 0, reducing the view's height to a minimum, then covering it with an opaque "note".
Click "Add", then select "Note", click in the Interface tab to create the note, then uncheck the "Transparent background" checkbox. Then drag and resize the note as needed.
There is officially no way to make the view disappear in NetLogo.
But (and I probably shouldn't be telling you this) there is a bug in NetLogo that you could take advantage of. If you run:
set-patch-size -1
...the view disappears!
If you save and re-load your model, however, it reappears. (This is because NetLogo makes sure that the view is some minimum size when loading a model.) You can get around that by using a startup procedure:
to startup
set-patch-size -1
end
But, be warned: you probably shouldn't do that. This is very much a hack. The bug will probably be fixed eventually, so you can't expect this to keep working. And it may very well cause other, unforeseeable problems.
The wisest thing to do is probably be to just move the view far out of the way, so that the user has to scroll a long way to see it. That would make the view "hidden" for most intents and purposes and wouldn't cause any trouble.

Show image in different view in NetLogo

I have to code a model that one part of this model is done
on patches and turtles, and another part only display
an image. I want to have these two parts in seperate
view simultaneously.
For example, my model is that it creates 100 turtles with
random xcor & ycor. I code that these turtles move around
view in random path. Now, I want show an image in
another seperate view and these two views (1. view of moving turtles 2. view of displaying an image) is displayed
simultaneously. My problem is that how can I have two seperate
views in NetLogo.
Thanks a lot in advance.
The feature you want doesn't really exist in NetLogo.
Not really. But check out https://github.com/NetLogo/NetLogo/wiki/Multiple-views-via-HubNet :
Users often ask if they can have more than one view in their model and show different things, or show the same things differently, in each one.
Hopefully in the future we'll provide this capability directly. But it is already possible now using HubNet with local clients. It's a bit awkward, but it works. [...]

How to code for user controlled movement of patches in the interface

I want to create a traffic simulation model where the user can move patches (that would act as nodes or junctions). Firstly is this possible , and if so would it be possible to see a code example? Secondly once this is done , will it be possible for the user to draw necessary links between nodes, upon which turtles can travel?
thanks
Yes, what you describe is very possible by combining a couple ideas. Check out two models in the the Code Examples folder of the Models Library: "Link-Walking Turtles" and "Mouse Drag One".