On Friday, February 27, 2015 at 11:41:11 AM UTC-5, Jason Bertsche wrote:
> 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.
>       
> 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
> 
> 
>         
>         
> 
>       
>       
> 
>       
> ​

Seems that variables become capitalized. 

For example,

In the netlogo file:

breed [agents agent]
agents-own [some-variable]

The java file would need to have the following in order to extract that 
variable:

agent.getBreedVariable("SOME-VARIABLE");

Hope this helps others.

-- 
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