bksnlow
bksnlow

Reputation: 137

How to do equation in Slider Netlogo

Im trying to change the maximum of a slider based on a Chooser. Something like

if confidence = "None" [set Maximum 1]

This is on the part of the slider that indicates the Maximum. However, i get the Expected Reporter Error, but i dont know how to do this right.

Upvotes: 1

Views: 60

Answers (1)

LeirsW
LeirsW

Reputation: 2305

The best solution, in my opinion, is writing a reporter in your code tab and using that reporter to determine the maximum of your slider:

to-report slidermaximum
  
  if confidence = "none" [report 1]

end

enter image description here

Another option is using ifelse-value, which allows you to return a reporter rather than a command. This one you can put directly into the slider menu.

ifelse-value confidence = "none" [1] [10]

I prefer the first one, since code hidden within your different submenus is easy to forget or overlook when you are making changes to the model later on.

Upvotes: 2

Related Questions