What is the error here? Which command and interface items should I add?

huangapple go评论52阅读模式
英文:

What is the error here? Which command and interface items should I add?

问题

我写了这个NetLogo代码,但一直出现错误。它期望在经济条件和其他参数上有命令,但我不知道如何放置这个命令。有人能识别出问题吗?

to setup-interface
  ; 设置视图
  resize-world 0 100 0 100 ; 根据您的要求调整世界大小
  set-patch-size 5 ; 根据您的要求调整图块大小
end

to create-monitor
  ; 创建监视器 `your text`
  create-monitor "经济状况" [
    set label "经济状况: "
    set "economic-conditions"
  ]
  create-monitor "资源可用性" [
    set label "资源可用性: "
    set "resource-availability"
  ]
end

to create-buttons
  ; 创建按钮
  create-button "开始" [ ;; 替换为实际模拟过程
    set label "开始"
    set action "模拟"
    set target "go"
  ]
  create-button "暂停" [ ;; 替换为实际暂停过程
    set label "暂停"
    set action "停止"
    set target "go"
  ]
  create-button "重置" [ ;; 替换为实际重置过程
    set label "重置"
    set action "设置"
    set target "go"
  ]
  
  ; 自定义按钮位置
  let button-spacing 10
  let button-height 20
  let button-width 60
  let button-offset 30
  set-button 1 "开始" (- button-width - button-spacing) (- button-height - button-spacing - button-offset)
  set-button 2 "暂停" (- button-spacing) (- button-height - button-spacing - button-offset)
  set-button 3 "重置" (button-width + button-spacing) (- button-height - button-spacing - button-offset)
  
  ; ...
end
英文:

I wrote this net logo code, but having an error all the time. It's expecting commands on the economic conditions and other parameters, but I don't know how to put the command. Can someone identify me the problems?

to setup-interface
 ; Set up the view
  resize-world 0 100 0 100 ; Adjust the world size as per your requirements
  set-patch-size 5 ; Adjust the patch size as per your requirements
end

  
to create-monitor
  ; Create monitors `your text`
  create-monitor "Economic Conditions" [
    set label "Economic Conditions: "
    set "economic-conditions"
  ]
  create-monitor "Resource Availability" [
    set label "Resource Availability: "
    set "resource-availability"
  ]
end

to create-buttons
  ; Create buttons
  create-button "Start" [ ;; Replace with the actual simulation procedure
    set label "Start"
    set action "simulate"
    set target "go"
  ]
  create-button "Pause" [ ;; Replace with the actual pause procedure
    set label "Pause"
    set action "stop"
    set target "go"
  ]
  create-button "Reset" [ ;; Replace with the actual reset procedure
    set label "Reset"
    set action "setup"
    set target "go"
  ]
  
  ; Customize button positions
  let button-spacing 10
  let button-height 20
  let button-width 60
  let button-offset 30
  set-button 1 "Start" (- button-width - button-spacing) (- button-height - button-spacing - button-offset)
  set-button 2 "Pause" (- button-spacing) (- button-height - button-spacing - button-offset)
  set-button 3 "Reset" (button-width + button-spacing) (- button-height - button-spacing - button-offset)
  
  ; ...
end

After the setup-interface, it's just the codes for the interface.

答案1

得分: 2

看起来 OP 尝试使用 ChatGPT 或类似的东西来生成 NetLogo 接口(包括按钮和监视器),但由于这些元素本来就不应该从代码标签中设置,所以完全失败了。

相反,你只需转到界面,然后右键单击某个位置,然后选择要添加的界面元素。

英文:

It looks like OP tried using ChatGPT or something similar in order to generate a NetLogo interface (including buttons and monitors), which completely failed since those things aren't meant to be setup from the code tab in the first place.

Instead, you just go to the interface and right click somewhere, after which you select the interface element you want to add

What is the error here? Which command and interface items should I add?

huangapple
  • 本文由 发表于 2023年5月25日 23:02:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76333723.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定