将影片基元从 NetLogo 5 转换为 6

Converting movie primitives from NetLogo 5 to 6

我正在尝试将以下过程从 NetLogo 5 转换为 6。

NL5 程序:

to make-movie
  user-message "Enter name ending with .mov"  
  let path user-new-file  
  if not is-string? path [ stop ]  
  reset movie-start  path 
  while [  ticks <= 300 ] [ run-model movie-grab-view ] 
  movie-close
end

我转换为 NL6:

to make-movie
  user-message "Enter name ending with .mov"  
  let path user-new-file
  if not is-string? path [ stop ]  
  reset vid:start-recorder path 
  while [  ticks <= 300 ] [ run-model vid:record-view ] 
  vid:save-recording path 
end

系统在下一行的 'path' 上标记我的转换错误...表明需要一个命令而不是 'path'[ 表示的要打开的文件=14=]

reset vid:start-recorder path

我已经通读了 vid extension docs ... as well as the transitions for the movie primitives,但就是不知道如何解决这个问题。

有什么建议、指点吗?

您可能只是忘记将 reset 更新为 vid:reset-recorder,它也是来自 vid 扩展。

vid:start-recorder 不将路径作为输入。您只需要 vid:save-recording

的路径

vid:save-recording 部分的 video extensions doc 中,他们说:

Note that at present the recording will always be saved in the “mp4” format.

所以您可能想要更改用户消息。 当我用下面的代码尝试时,文件扩展名是自动写入的。

extensions[vid]

to setup
  ca
  reset-ticks
  crt 10
end

to make-movie
  setup
  user-message "Enter name ending with .mov"  
  let path user-new-file
  if not is-string? path [ stop ]  
  vid:reset-recorder
  vid:start-recorder 
  while [  ticks <= 10 ] 
  [
    go vid:record-view
  ] 
  vid:save-recording path 
end

to go
  ask turtles [
    fd 1
  ]
  tick
end