There generally isn’t better documentation for writing extensions than just the Extensions API wiki page you linked or the source code itself. In this case, you’re trying to do the very thing that an existing NetLogo primitive does, so you can get the answer from the primitive’s source code. The code for getting a breed variable can be found here <https://github.com/NetLogo/NetLogo/blob/5.x/src/main/org/nlogo/prim/_breedvariableof.java#L45>.

On 2/27/2015 10:34 AM, [email protected] wrote:

Hello,

I have been searching and cannot find a tutorial that explains basic extension 
API.

I have seen: https://github.com/NetLogo/NetLogo/wiki/Extensions-API and 
http://ccl.northwestern.edu/netlogo/docs/scaladoc/ (though this is scale...I 
would think that there would be explanations of the functions).

Is there better resources?

I would like to know how to extract the value of a specific agent's variable. 
The getVariable function requires a number(the index of the variable in the 
variables array). I need to know how to obtain the index of the variable:

AgentSet agents = ...
Agent agent = ...
int someIntValue  = 
Integer.valueOf(agent.getVariables(agent.world().breedsOwnIndex(agents, 
"some-variable")));

This seems too complicated for such a simple task.

Thank you
-Matt

​

--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to