YAKOVM
YAKOVM

Reputation: 10153

Event in Netlogo

I use Netlogo 6.0.4, In the interface there is a chooserbutton, which is a set of different colors I want to change all patches colors when the color changes, i.e. when event happens. As alternative , I can add a button to color patches based on color which was chosen recently, but I prefer not to. Is there some solution for that

Upvotes: 0

Views: 72

Answers (1)

JenB
JenB

Reputation: 17678

A button pushes a piece of code into the run, but a chooser just selects a particular value of a variable. If you want to control colours during the run with a chooser, then you need to query that variable regularly. Since your question says that you want to change colour when an even happens, then you could simply query the variable when that event occurs.

Alternatively, just have ask patches [ set pcolor patch-color ] in the go procedure (assuming your chooser is called patch-color). Assuming you have the standard NetLogo setup of a go procedure with all your actions and the tick then your patches will be appropriately coloured but there will be a slight delay between the event occurring and the change of colour because it won't update until that code is reached.

Upvotes: 1

Related Questions