Hey Sven,
If you just want to store extra data for a patch, but you don't need that data available in Netlogo code as a normal patches-own variable, it isn't too hard. As Seth said in his answer, you just need to make a map from patches to your new data to store in your extension. Off the top of my head, the Physics extension does something like this to store physics data for patches and turtles: https://github.com/Loafie/netlogo_phys_extension/blob/master/src/PhysExtension.scala#L29
I should point out you can still give access to the data in NetLogo code, just not as `[my-var] of patch 0 0` but using a custom reporter defined by your extension, like `my-ext:my-var-of patch 0 0`.
If you do want to let NetLogo code access your custom patch data like a totally normal patches-own variable, then that would still be a pretty involved process, which Seth laid out the very basic steps of.
Another option that might work would be to have a way to let the users register a patch variable as the one for the extension to store data in, `my-ext:set-patch-var "my-var"`. This would let the variable be referenced as normal in code, and you're extension could use the user-provided value for whatever its doing. One downside here is I think "my-var" would have to just be a string, meaning it won't be compile-time checked for correctness.
I hope that helps.
-Jeremy
--
You received this message because you are subscribed to the Google Groups "netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
netlogo-deve...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/netlogo-devel/d5df52d3-d460-4b7d-94e3-06ab5cf8107ao%40googlegroups.com.